feat(construction): Phase 3.1 카테고리관리 API 연동 완료

- apiClient에 patch 메서드 추가
- apiClient.get에 params 옵션 지원 추가
- updateCategory: PUT → PATCH 수정
- reorderCategories: PUT → POST 수정
This commit is contained in:
2026-01-09 22:01:47 +09:00
parent ae90bd7c52
commit e4b5e6ae30
2 changed files with 23 additions and 6 deletions

View File

@@ -102,9 +102,16 @@ export class ApiClient {
/**
* GET 요청
* @param endpoint API 엔드포인트
* @param options 쿼리 파라미터 등 옵션
*/
async get<T>(endpoint: string): Promise<T> {
return this.request<T>(endpoint, { method: 'GET' });
async get<T>(endpoint: string, options?: { params?: Record<string, string> }): Promise<T> {
let url = endpoint;
if (options?.params) {
const searchParams = new URLSearchParams(options.params);
url = `${endpoint}?${searchParams.toString()}`;
}
return this.request<T>(url, { method: 'GET' });
}
/**
@@ -127,6 +134,16 @@ export class ApiClient {
});
}
/**
* PATCH 요청
*/
async patch<T>(endpoint: string, data?: unknown): Promise<T> {
return this.request<T>(endpoint, {
method: 'PATCH',
body: data ? JSON.stringify(data) : undefined,
});
}
/**
* DELETE 요청
*/