Skip to content

Commit 3ef9a58

Browse files
authored
Merge branch 'develop' into feat/#20/후기검색-마이-페이지구현
2 parents 8a3ca32 + 6ef5435 commit 3ef9a58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2267
-340
lines changed

package-lock.json

Lines changed: 361 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
},
1212
"dependencies": {
1313
"@faker-js/faker": "^9.9.0",
14+
"axios": "^1.11.0",
1415
"clsx": "^2.1.1",
1516
"react": "^19.1.0",
1617
"react-dom": "^19.1.0",
18+
"react-modal": "^3.16.3",
1719
"react-router-dom": "^7.6.3",
1820
"styled-components": "^6.1.19",
1921
"tailwind-merge": "^3.3.1",
@@ -26,6 +28,7 @@
2628
"@types/node": "^24.0.7",
2729
"@types/react": "^19.1.8",
2830
"@types/react-dom": "^19.1.6",
31+
"@types/react-modal": "^3.16.3",
2932
"@types/styled-components": "^5.1.34",
3033
"@vitejs/plugin-react-swc": "^3.10.2",
3134
"autoprefixer": "^10.4.21",

src/App.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import { RouterProvider } from 'react-router-dom';
22
import router from '@/routes/route';
3-
import { Modal } from '@/components';
3+
import { Modal } from '@/components';
4+
import ToastProvider from './components/common/Toast/ToastProvider';
45

56
function App() {
67
console.log('App 렌더됨');
78
return (
8-
<>
9+
<ToastProvider>
910
<RouterProvider router={router} />
1011
<Modal />
11-
</>
12+
</ToastProvider>
1213
);
1314
}
1415

15-
export default App;
16+
export default App;

src/__mocks/mockSeat.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { Seat } from '../../src/types/seat';
2+
3+
export const mockSeats: Seat[] = [];
4+
5+
const rows = 'ABCDEFGHIJKLMNOP'.split(''); // A ~ P
6+
const columns = Array.from({ length: 23 }, (_, i) => i + 5); // 5 ~ 27
7+
8+
rows.forEach((row) => {
9+
columns.forEach((col) => {
10+
const shouldExist = Math.random() < 0.7;
11+
if (!shouldExist) return;
12+
13+
const hasReview = Math.random() < 0.3;
14+
const isWheelchair = row === 'A' && col >= 10 && col <= 13;
15+
16+
const seat: Seat = {
17+
seatId: `13018${row}${col}`,
18+
row,
19+
column: col,
20+
hasReview,
21+
score: hasReview ? parseFloat((Math.random() * 5).toFixed(1)) : undefined,
22+
isWheelchair,
23+
};
24+
25+
mockSeats.push(seat);
26+
});
27+
});

src/api/api.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import type { ApiError, ApiResponse } from '@/types/api-response';
2+
import axios from 'axios';
3+
4+
const BASE_URL = import.meta.env.VITE_API_URL;
5+
6+
const api = axios.create({
7+
baseURL: BASE_URL,
8+
timeout: 7000,
9+
headers: {
10+
'Content-Type': 'application/json',
11+
},
12+
withCredentials: true,
13+
});
14+
15+
// 요청 인터셉터 - 모든 요청에 Authorization 헤더를 추가
16+
api.interceptors.request.use(
17+
(config) => {
18+
const token = localStorage.getItem('accessToken');
19+
if (token) {
20+
config.headers.Authorization = `Bearer ${token}`;
21+
}
22+
return config;
23+
},
24+
(error) => Promise.reject(error),
25+
);
26+
27+
// 응답 인터셉터
28+
api.interceptors.response.use(
29+
(response) => {
30+
const res = response.data as ApiResponse<any>;
31+
32+
if (!res.success) {
33+
const apiError: ApiError = {
34+
message: res.message || '알 수 없는 오류가 발생했습니다.',
35+
code: res.code,
36+
error: Array.isArray(res.error) ? res.error : null,
37+
};
38+
39+
return Promise.reject(apiError);
40+
}
41+
42+
return res.data;
43+
},
44+
(error) => {
45+
const status = error.response?.status;
46+
const resData = error.response?.data as ApiResponse<any> | undefined;
47+
48+
const apiError: ApiError = {
49+
message: resData?.message || '네트워크 오류 또는 서버 에러가 발생했습니다.',
50+
code: resData?.code || status || 'UNKNOWN',
51+
error: Array.isArray(resData?.error) ? resData?.error : null,
52+
};
53+
54+
return Promise.reject(apiError);
55+
},
56+
);
57+
58+
export default api;

src/assets/icons/check.svg

Lines changed: 3 additions & 0 deletions
Loading

src/assets/icons/seeat_logo.svg

Lines changed: 7 additions & 0 deletions
Loading

src/assets/icons/star_fill.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)