Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/api/axiosInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down
4 changes: 1 addition & 3 deletions src/api/games/patchGameParticipate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
4 changes: 1 addition & 3 deletions src/api/games/patchMannerScoreReview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
7 changes: 4 additions & 3 deletions src/api/games/postGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PostGameResponse>('/games', {
data: payload,
});
const { data } = await axiosInstance.post<PostGameResponse>(
'/games',
payload
);

return data;
};
4 changes: 1 addition & 3 deletions src/api/games/postGameParticipate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
4 changes: 1 addition & 3 deletions src/api/member/postRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import {
export const postRegistration = async (payload: PostRegistrationRequest) => {
const { data } = await axiosInstance.post<PostRegistrationResponse>(
'/members',
{
data: payload,
}
payload
);

return data;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AllServicesPage/AllServicesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/GamesHostPage/GamesHostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const GamesHostPage = () => {
{isGameEnded(startTime, game.playTimeMinutes) && (
<MatchItem.BottomButton
onClick={() =>
navigate(PATH_NAME.GET_GAMES_MANAGE_PATH(String(game.id)))
navigate(PATH_NAME.GET_GAMES_REVIEW_PATH(String(game.id)))
}
>
리뷰 남기기
Expand Down
9 changes: 3 additions & 6 deletions src/utils/formatDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}`;
};
4 changes: 3 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/, ''),
},
},
},
Expand Down
4 changes: 3 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/, ''),
},
},
},
Expand Down