diff --git a/src/api/axiosInstance.ts b/src/api/axiosInstance.ts index 11eb93fa..b52fcb6a 100644 --- a/src/api/axiosInstance.ts +++ b/src/api/axiosInstance.ts @@ -2,8 +2,11 @@ import axios from 'axios'; import { setAuthorization } from './interceptors'; +const PROD = import.meta.env.MODE === 'production'; +const baseURL = PROD ? import.meta.env.VITE_BASE_URL : '/api'; + export const axiosInstance = axios.create({ - baseURL: '/api', + baseURL, headers: { 'Content-type': 'application/json', }, diff --git a/src/api/games/patchGameParticipate.ts b/src/api/games/patchGameParticipate.ts index 48b4edb2..f9a9de3f 100644 --- a/src/api/games/patchGameParticipate.ts +++ b/src/api/games/patchGameParticipate.ts @@ -12,8 +12,6 @@ export const patchGameParticipate = async ({ gameId: Game['id']; memberId: Member['id']; }) => { - await axiosInstance.patch(`/games/${gameId}/members/${memberId}`, { - data: payload, - }); + await axiosInstance.patch(`/games/${gameId}/members/${memberId}`, payload); return; }; diff --git a/src/api/games/patchMannerScoreReview.ts b/src/api/games/patchMannerScoreReview.ts index bd1de0d5..d69516b5 100644 --- a/src/api/games/patchMannerScoreReview.ts +++ b/src/api/games/patchMannerScoreReview.ts @@ -10,8 +10,6 @@ export const patchMannerScoreReview = async ({ payload: PatchGameMannerScoreReviewRequest; gameId: Game['id']; }) => { - await axiosInstance.patch(`/games/${gameId}/members/manner-scores`, { - data: payload, - }); + await axiosInstance.patch(`/games/${gameId}/members/manner-scores`, payload); return; }; diff --git a/src/api/games/postGame.ts b/src/api/games/postGame.ts index 7a303d67..e1465a76 100644 --- a/src/api/games/postGame.ts +++ b/src/api/games/postGame.ts @@ -3,9 +3,10 @@ import { axiosInstance } from '@api/axiosInstance'; import { PostGameRequest, PostGameResponse } from '@type/api/games'; export const postGame = async (payload: PostGameRequest) => { - const { data } = await axiosInstance.post('/games', { - data: payload, - }); + const { data } = await axiosInstance.post( + '/games', + payload + ); return data; }; diff --git a/src/api/games/postGameParticipate.ts b/src/api/games/postGameParticipate.ts index cd9deb99..25f209f1 100644 --- a/src/api/games/postGameParticipate.ts +++ b/src/api/games/postGameParticipate.ts @@ -10,7 +10,5 @@ export const postGameParticipate = async ({ payload: PostGameParticipateRequest; gameId: Game['id']; }) => { - await axiosInstance.post(`/games/${gameId}/members`, { - data: payload, - }); + await axiosInstance.post(`/games/${gameId}/members`, payload); }; diff --git a/src/api/member/postRegistration.ts b/src/api/member/postRegistration.ts index 3cde8767..7f5a48dd 100644 --- a/src/api/member/postRegistration.ts +++ b/src/api/member/postRegistration.ts @@ -8,9 +8,7 @@ import { export const postRegistration = async (payload: PostRegistrationRequest) => { const { data } = await axiosInstance.post( '/members', - { - data: payload, - } + payload ); return data; diff --git a/src/pages/AllServicesPage/AllServicesPage.tsx b/src/pages/AllServicesPage/AllServicesPage.tsx index 11e1e503..8671597d 100644 --- a/src/pages/AllServicesPage/AllServicesPage.tsx +++ b/src/pages/AllServicesPage/AllServicesPage.tsx @@ -32,7 +32,7 @@ export const AllServicesPage = () => { }; const getMyId = (): string | null => { - const data = localStorage.getItem('USER_INFO'); + const data = localStorage.getItem('LOGIN_INFO'); if (!data) { return null; diff --git a/src/pages/GamesHostPage/GamesHostPage.tsx b/src/pages/GamesHostPage/GamesHostPage.tsx index 278865c7..e54de0b3 100644 --- a/src/pages/GamesHostPage/GamesHostPage.tsx +++ b/src/pages/GamesHostPage/GamesHostPage.tsx @@ -72,7 +72,7 @@ export const GamesHostPage = () => { {isGameEnded(startTime, game.playTimeMinutes) && ( - navigate(PATH_NAME.GET_GAMES_MANAGE_PATH(String(game.id))) + navigate(PATH_NAME.GET_GAMES_REVIEW_PATH(String(game.id))) } > 리뷰 남기기 diff --git a/src/utils/formatDate.ts b/src/utils/formatDate.ts index 25a5afd7..759c62b0 100644 --- a/src/utils/formatDate.ts +++ b/src/utils/formatDate.ts @@ -2,11 +2,8 @@ export const formatDate = (date: Date) => { const year = date.getFullYear(); const month = date.getMonth() + 1; const day = date.getDate(); - const dayOfWeek = date.toLocaleDateString('ko-KR', { - weekday: 'long', - }); - const formattedDate = `${year}년 ${month}월 ${day}일 (${dayOfWeek})`; - - return formattedDate; + return `${year}-${month >= 10 ? month : '0' + month}-${ + day >= 10 ? day : '0' + day + }`; }; diff --git a/vite.config.ts b/vite.config.ts index f7e96665..bdf4772c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,7 +8,9 @@ export default defineConfig({ server: { proxy: { '/api': { - target: 'http://localhost:3000/', + target: process.env.VITE_BASE_URL, + changeOrigin: true, + rewrite: (path) => path.replace(/^\/api/, ''), }, }, }, diff --git a/vitest.config.ts b/vitest.config.ts index 01f22edb..9622016b 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -9,7 +9,9 @@ export default defineConfig({ server: { proxy: { '/api': { - target: 'http://localhost:3000/', + target: process.env.VITE_BASE_URL, + changeOrigin: true, + rewrite: (path) => path.replace(/^\/api/, ''), }, }, },