-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat : axios 전역 핸들러 처리 * feat : api 호출 로직 작성 * env : yarn 버전 업그레이드 * chore : 서버에서 오는 에러에 맞게 수정 * feat : 편지 작성 훅 개발 * env : 리엑트 쿼리 설치 * feat : api 커스텀 에러 설정 및 에러 반환 로직 구현 * feat : 편지 전송 * chore : 사용하지 않는 의존성 제거 * chore : 훅 index 경로 수정 * feat : 쿼리 프로바이더 추가 * env : tanksquery 버전 업그레이드 * feat : 전송 로직 수정
- Loading branch information
Showing
19 changed files
with
7,552 additions
and
8,952 deletions.
There are no files selected for viewing
160 changes: 80 additions & 80 deletions
160
.yarn/releases/yarn-4.5.2.cjs → .yarn/releases/yarn-4.5.3.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
nodeLinker: pnp | ||
|
||
yarnPath: .yarn/releases/yarn-4.5.2.cjs | ||
yarnPath: .yarn/releases/yarn-4.5.3.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ | |
"gen-pwa": "vite build && vite preview" | ||
}, | ||
"dependencies": { | ||
"@tanstack/react-query": "^5.60.2", | ||
"@tanstack/react-query": "^5.62.2", | ||
"@tanstack/react-query-devtools": "^5.62.2", | ||
"@turf/turf": "^7.1.0", | ||
"axios": "^1.7.7", | ||
"canvas-confetti": "^1.9.3", | ||
|
@@ -29,6 +30,7 @@ | |
"react-dom": "^18.3.1", | ||
"react-icons": "^5.3.0", | ||
"react-map-gl": "^7.1.7", | ||
"react-query": "^3.39.3", | ||
"react-router-dom": "^7.0.1", | ||
"react-spring": "^9.7.4", | ||
"react-spring-bottom-sheet": "3.5.0-alpha.0", | ||
|
@@ -90,7 +92,7 @@ | |
"vite-plugin-pwa": "^0.21.0", | ||
"vite-plugin-svgr": "^4.3.0" | ||
}, | ||
"packageManager": "[email protected].2", | ||
"packageManager": "[email protected].3", | ||
"eslintConfig": { | ||
"extends": [ | ||
"plugin:storybook/recommended" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import ToastContainer from './components/Common/ToastContainer/ToastContainer'; | ||
import { RouterProvider } from 'react-router-dom'; | ||
import { router } from '@/router'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; | ||
|
||
export const App = () => { | ||
const queryClient = new QueryClient(); | ||
|
||
return ( | ||
<> | ||
<QueryClientProvider client={queryClient}> | ||
<ToastContainer /> | ||
<RouterProvider router={router} /> | ||
</> | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
</QueryClientProvider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { createLetter } from '@/service/letter/create/createLetter'; | ||
import { useToastStore } from '@/hooks/useToastStore'; | ||
import { LetterType } from '@/types/letter'; | ||
import { ApiErrorType } from './../types/apiError'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
export const useCreateLetter = () => { | ||
const { addToast } = useToastStore(); | ||
const navigate = useNavigate(); | ||
|
||
return useMutation({ | ||
mutationKey: ['createLetter'], | ||
mutationFn: (letterData: LetterType) => createLetter(letterData), | ||
|
||
onSuccess: () => { | ||
navigate('/letter/success'); | ||
}, | ||
onError: (error: ApiErrorType) => { | ||
addToast(`${error.message}`, 'warning'); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import { StrictMode } from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import './index.css'; | ||
import { App } from '@/App'; | ||
import './mocks'; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<QueryClientProvider client={queryClient}> | ||
<App /> | ||
</QueryClientProvider> | ||
</StrictMode> | ||
<div> | ||
<App /> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { LetterType, CreateLetterResponseType } from '@/types/letter'; | ||
import { defaultApi } from '@/service/api'; | ||
|
||
export const createLetter = async ({ | ||
title, | ||
content, | ||
keywords, | ||
font, | ||
paper, | ||
label | ||
}: LetterType): Promise<CreateLetterResponseType> => { | ||
const api = defaultApi(); | ||
|
||
const response = await api.post('/letters', { | ||
title, | ||
content, | ||
keywords, | ||
font, | ||
paper, | ||
label | ||
}); | ||
return response.data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type ApiErrorType = { | ||
isSuccess: boolean; | ||
code: string; | ||
message: string; | ||
}; |
Oops, something went wrong.