feat(construction): Phase 3.1 카테고리관리 API 연동 완료
- apiClient에 patch 메서드 추가 - apiClient.get에 params 옵션 지원 추가 - updateCategory: PUT → PATCH 수정 - reorderCategories: PUT → POST 수정
This commit is contained in:
@@ -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 요청
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user