diff --git a/frontend/src/api/axiosConfig.ts b/frontend/src/api/axiosConfig.ts index adb3d4e..a7864e2 100644 --- a/frontend/src/api/axiosConfig.ts +++ b/frontend/src/api/axiosConfig.ts @@ -3,6 +3,7 @@ import useAuthStore from '@/stores/useAuthStore'; import { BaseResponse, CustomError, SuccessResponse, RefreshTokenResponseDTO } from '@/types'; const baseURL = 'https://j11s002.p.ssafy.io'; +// const baseURL = 'http://localhost:5173'; 모킹 테스트 const api = axios.create({ baseURL, @@ -105,8 +106,6 @@ const handleCommonErrors = (error: AxiosError>) => { window.location.href = '/'; } else { console.error('오류 발생:', error.response?.data?.message || '알 수 없는 오류'); - useAuthStore.getState().clearAuth(); - window.location.href = '/'; } }; diff --git a/frontend/src/api/folderApi.ts b/frontend/src/api/folderApi.ts index e2cfab2..7115907 100644 --- a/frontend/src/api/folderApi.ts +++ b/frontend/src/api/folderApi.ts @@ -10,7 +10,6 @@ export const fetchFolderApi = async ( try { const response = await api.get(`/api/projects/${projectId}/folders/${folderId}`, { params: { memberId }, - withCredentials: true, }); return response.data; } catch (error) { @@ -32,7 +31,6 @@ export const updateFolderApi = async ( try { const response = await api.put(`/api/projects/${projectId}/folders/${folderId}`, folderData, { params: { memberId }, - withCredentials: true, }); return response.data; } catch (error) { @@ -53,7 +51,6 @@ export const deleteFolderApi = async ( try { const response = await api.delete(`/api/projects/${projectId}/folders/${folderId}`, { params: { memberId }, - withCredentials: true, }); return response.data; } catch (error) { @@ -74,7 +71,6 @@ export const createFolderApi = async ( try { const response = await api.post(`/api/projects/${projectId}/folders`, folderData, { params: { memberId }, - withCredentials: true, }); return response.data; } catch (error) { @@ -95,7 +91,6 @@ export const fetchFolderReviewListApi = async ( try { const response = await api.get(`/api/projects/${projectId}/folders/${folderId}/review`, { params: { memberId }, - withCredentials: true, }); return response.data; } catch (error) { diff --git a/frontend/src/api/imageApi.ts b/frontend/src/api/imageApi.ts index 30c70b4..9a0a400 100644 --- a/frontend/src/api/imageApi.ts +++ b/frontend/src/api/imageApi.ts @@ -11,7 +11,6 @@ export const fetchImageApi = async ( try { const response = await api.get(`/api/projects/${projectId}/folders/${folderId}/images/${imageId}`, { params: { memberId }, - withCredentials: true, }); return response.data; } catch (error) { @@ -34,7 +33,6 @@ export const moveImageApi = async ( try { const response = await api.put(`/api/projects/${projectId}/folders/${folderId}/images/${imageId}`, moveRequest, { params: { memberId }, - withCredentials: true, }); return response.data; } catch (error) { @@ -56,7 +54,6 @@ export const deleteImageApi = async ( try { const response = await api.delete(`/api/projects/${projectId}/folders/${folderId}/images/${imageId}`, { params: { memberId }, - withCredentials: true, }); return response.data; } catch (error) { @@ -82,7 +79,6 @@ export const changeImageStatusApi = async ( statusChangeRequest, { params: { memberId }, - withCredentials: true, } ); return response.data; @@ -108,7 +104,6 @@ export const uploadImageListApi = async ( { imageList }, { params: { memberId }, - withCredentials: true, } ); return response.data; diff --git a/frontend/src/api/lablingApi.ts b/frontend/src/api/lablingApi.ts new file mode 100644 index 0000000..569c80b --- /dev/null +++ b/frontend/src/api/lablingApi.ts @@ -0,0 +1,52 @@ +import api from '@/api/axiosConfig'; +import { AxiosError, AxiosResponse } from 'axios'; +import { BaseResponse } from '@/types'; +import { LabelingRequestDTO } from '@/types'; + +export const saveImageLabelingApi = async ( + projectId: number, + imageId: number, + memberId: number, + data: LabelingRequestDTO +): Promise>> => { + try { + const response: AxiosResponse>> = await api.post( + `/api/projects/${projectId}/label/image/${imageId}`, + data, + { + params: { memberId }, + } + ); + return response.data; + } catch (error) { + if (error instanceof AxiosError) { + console.error('이미지 레이블링 저장 실패:', error.response?.data?.message || '알 수 없는 오류'); + } else { + console.error('알 수 없는 오류가 발생했습니다.'); + } + throw error; + } +}; + +export const autoLabelingApi = async ( + projectId: number, + memberId: number +): Promise>> => { + try { + const response: AxiosResponse>> = await api.post( + `/api/projects/${projectId}/label/auto`, + {}, + { + params: { memberId }, + } + ); + return response.data; + } catch (error) { + if (error instanceof AxiosError) { + console.error('오토 레이블링 실패:', error.response?.data?.message || '알 수 없는 오류'); + } else { + console.error('알 수 없는 오류가 발생했습니다.'); + } + throw error; + } +};