ship-gis/src/api/favoriteApi.ts
htlee 6e3ad9e0d8 chore: JavaScript → TypeScript 전환 완료 (77개 파일)
JS/JSX 77개 파일을 TS/TSX로 전환하고 JS 원본을 삭제.
- stores 7개, map core 6개, hooks 4개 등 전체 모듈 전환
- TypeScript strict 모드, OL/Deck.gl 타입 적용
- .gitignore에서 TS/TSX 무시 규칙 제거
- pre-commit hook: .js,.jsx → .ts,.tsx 확장자 변경
- tsc --noEmit 0 에러, ESLint 0 에러, yarn build 성공

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:28:27 +09:00

40 lines
1.2 KiB
TypeScript

import { fetchWithAuth } from './fetchWithAuth';
/** 관심선박 API 응답 아이템 */
export interface FavoriteShipItem {
signalSourceCode?: string;
targetId?: string;
[key: string]: unknown;
}
/** 관심구역 API 응답 아이템 */
export interface RealmItem {
[key: string]: unknown;
}
/**
* 관심선박 목록 조회
* @returns {Promise<FavoriteShipItem[]>} 관심선박 목록
*/
export async function fetchFavoriteShips(): Promise<FavoriteShipItem[]> {
const response = await fetchWithAuth('/api/gis/my/dashboard/ship/attention/static/search');
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
return result?.data || [];
}
/**
* 관심구역 목록 조회
* @returns {Promise<RealmItem[]>} 관심구역 목록
*/
export async function fetchRealms(): Promise<RealmItem[]> {
const response = await fetchWithAuth('/api/gis/sea-relm/manage/show', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
return result?.seaRelmManageShowDtoList || [];
}