diff --git a/src/apis/server.ts b/src/apis/server.ts index aaa894bb..0f116319 100644 --- a/src/apis/server.ts +++ b/src/apis/server.ts @@ -19,31 +19,25 @@ import { ApiErrorResponse } from '@src/types/apis/apiResponse'; const SERVER_BASE_URL = '/servers'; const buildServerUrl = (path: string = '') => `${SERVER_BASE_URL}${path}`; -export const postServer = async < - Res = { serverId: number }, - Req extends { - name: string; - description: string; - serverImg: File | null; - } = Pick & { - serverImg: File | null; - }, ->( - body: Req, +export const postServer = async ( + body: PostServerReq, headers?: Record, -): Promise => { +): Promise> => { const formData = new FormData(); formData.append('name', body.name); formData.append('description', body.description); if (body.serverImg) { formData.append('serverImg', body.serverImg); } - - const response = await authClient.post>( - buildServerUrl(), - formData, - { headers: { 'Content-Type': 'multipart/form-data', ...headers } }, - ); + const response = await authClient.post< + ApiResponse<{ serverId: number }>, + AxiosResponse> + >(buildServerUrl(), formData, { + headers: { + 'Content-Type': 'multipart/form-data', + ...headers, + }, + }); return response.data; };