Skip to content

Commit 100c0d9

Browse files
authored
[FRONTEND] 호환성체크 모달 및 견적 api 연결 (#97)
호환성체크 모달 제작 및 견적 api 연결
1 parent 0f98433 commit 100c0d9

Some content is hidden

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

48 files changed

+286
-403
lines changed

frontend/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import MyPage from "./pages/MyPage";
1111
import SignIn from "./pages/SignIn";
1212
import Setting from "./pages/Setting";
1313
import SecondSetting from "./pages/SecondSetting";
14-
import RedirectPage from "./pages/oauth/kakao/RedirectPage";
14+
import RedirectPage from "./pages/RedirectPage";
1515
import ExpertVerifyLayout from "./components/layout/ExpertVerifyLayout";
1616
import { ProtectedRoute } from "./routes/ProtectedRoute";
1717
import RootRedirect from "./routes/RootRedirect";

frontend/src/api/Quote/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Quote API 통합 export
2+
3+
export { usePostQuote } from './usePostQuote';
4+
export { useGetQuotes } from './useGetQuotes';
5+
export { useQuoteDetail } from './useQuoteDetail';
6+
export { useEditQuote } from './useEditQuote';
7+
export { useDeleteQuote } from './useDeleteQuote';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { useMutation } from '@tanstack/react-query';
2+
import { quoteService } from '../services/quoteService';
3+
4+
export const useDeleteQuote = () => {
5+
return useMutation({
6+
mutationFn: (quoteId: number) => quoteService.deleteQuote(quoteId),
7+
});
8+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { useMutation } from '@tanstack/react-query';
2+
import { quoteService } from '../services/quoteService';
3+
import type { UpdateQuoteRequest } from '@/types/quote';
4+
5+
interface EditQuoteParams {
6+
quoteId: number;
7+
data: UpdateQuoteRequest;
8+
}
9+
10+
export const useEditQuote = () => {
11+
return useMutation({
12+
mutationFn: ({ quoteId, data }: EditQuoteParams) =>
13+
quoteService.updateQuote(quoteId, data),
14+
});
15+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { useQuery } from '@tanstack/react-query';
2+
import { quoteService } from '../services/quoteService';
3+
import { QUERY_KEYS } from '@/constants/queryKeys';
4+
5+
export const useGetQuotes = () => {
6+
return useQuery({
7+
queryKey: [QUERY_KEYS.QUOTES],
8+
queryFn: () => quoteService.getQuotes(),
9+
});
10+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { useMutation } from '@tanstack/react-query';
2+
import { quoteService } from '../services/quoteService';
3+
import type { CreateQuoteRequest } from '@/types/quote';
4+
5+
export const usePostQuote = () => {
6+
return useMutation({
7+
mutationFn: (data: CreateQuoteRequest) => quoteService.createQuote(data),
8+
});
9+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { useQuery } from '@tanstack/react-query';
2+
import { quoteService } from '../services/quoteService';
3+
import { QUERY_KEYS } from '@/constants/queryKeys';
4+
5+
export const useQuoteDetail = (quoteId: number) => {
6+
return useQuery({
7+
queryKey: [QUERY_KEYS.QUOTE_DETAIL, quoteId],
8+
queryFn: () => quoteService.getQuoteDetail(quoteId),
9+
enabled: !!quoteId,
10+
});
11+
};

frontend/src/api/core/queryConfig.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export const queryKeys = {
6464
HISTORY: (size?: number) =>
6565
size ? ['glossary', 'history', size] : ['glossary', 'history'] as const,
6666
},
67+
68+
QUOTES: ['quotes'] as const,
69+
QUOTE_DETAIL: 'quote-detail' as const,
6770

6871
PRODUCTS: {
6972
ALL: ['products'] as const,
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Quote 관련 API 서비스
2+
3+
import { client } from '../core/client';
4+
import { API_ENDPOINTS } from '@/config/api';
5+
import type { ApiResponse } from '@/types/api';
6+
import type {
7+
Quote,
8+
QuoteListResponse,
9+
CreateQuoteRequest,
10+
UpdateQuoteRequest,
11+
} from '@/types/quote';
12+
13+
export const quoteService = {
14+
// 견적서 생성
15+
createQuote: async (data: CreateQuoteRequest): Promise<ApiResponse<null>> => {
16+
return client.post(API_ENDPOINTS.QUOTES.BASE, data);
17+
},
18+
19+
// 견적서 목록 조회
20+
getQuotes: async (): Promise<ApiResponse<QuoteListResponse[]>> => {
21+
return client.get(API_ENDPOINTS.QUOTES.BASE);
22+
},
23+
24+
// 견적서 상세 조회
25+
getQuoteDetail: async (quoteId: number): Promise<ApiResponse<Quote>> => {
26+
return client.get(API_ENDPOINTS.QUOTES.DETAIL(quoteId));
27+
},
28+
29+
// 견적서 수정
30+
updateQuote: async (
31+
quoteId: number,
32+
data: UpdateQuoteRequest
33+
): Promise<ApiResponse<null>> => {
34+
return client.put(API_ENDPOINTS.QUOTES.DETAIL(quoteId), data);
35+
},
36+
37+
// 견적서 삭제
38+
deleteQuote: async (quoteId: number): Promise<ApiResponse<null>> => {
39+
return client.delete(API_ENDPOINTS.QUOTES.DETAIL(quoteId));
40+
},
41+
};
Lines changed: 5 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)