Skip to content

Commit c4a8510

Browse files
Merge pull request #274 from ItRecode/FE-261
[FE-261] feat: ํƒˆํ‡ด ์‹œ ์žฌ๊ฐ€์ž…๋ถˆ๊ฐ€ ํ™”๋ฉด ๊ตฌํ˜„
2 parents 7a9e830 + 024732f commit c4a8510

4 files changed

Lines changed: 72 additions & 6 deletions

File tree

โ€Žsrc/assets/heart_large.svgโ€Ž

Lines changed: 9 additions & 0 deletions
Loading
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from 'react'
2+
import { useLocation, useNavigate } from 'react-router-dom'
3+
import Button from '@components/Button'
4+
import { ReactComponent as HeartIcon } from '@assets/heart_large.svg'
5+
import { ReactComponent as CloseIcon } from '@assets/close_icon.svg'
6+
import { getFormattedDate } from '@utils/getFormattedDate'
7+
8+
export default function WithdrawSignUp() {
9+
const navigate = useNavigate()
10+
const { state } = useLocation()
11+
12+
return (
13+
<>
14+
<CloseIcon
15+
className="ml-6 mt-4 cursor-pointer"
16+
onClick={() => navigate('/', { replace: true })}
17+
/>
18+
<div className="flex h-full flex-col items-center justify-center px-5">
19+
<HeartIcon className="mb-10" />
20+
<p className="mb-14 text-center text-[20px] font-semibold leading-[30px] text-grey-10">
21+
<span className="text-primary-2">
22+
{getFormattedDate(new Date(state.date), 'point')}{' '}
23+
</span>
24+
์ดํ›„๋กœ
25+
<br />
26+
์žฌ๊ฐ€์ž…์ด ๊ฐ€๋Šฅํ•ด์š”
27+
</p>
28+
<Button
29+
disabled={false}
30+
property="solid"
31+
onClick={() => navigate('/', { replace: true })}
32+
>
33+
๋ ˆ์ฝ”๋”ง ๋‘˜๋Ÿฌ๋ณด๊ธฐ
34+
</Button>
35+
</div>
36+
</>
37+
)
38+
}

โ€Žsrc/react-query/hooks/useAuth.tsโ€Ž

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ export const useAuth = () => {
5252
onSuccess: () => {
5353
redirectPage()
5454
},
55-
onError: () => {
55+
onError: (error: AxiosError) => {
56+
if (error.response?.status === 403) {
57+
const { data } = error.response as AxiosResponse
58+
navigate('/sign-up/fail', {
59+
state: { date: data.msg },
60+
})
61+
return
62+
}
63+
5664
navigate('/login')
5765
},
5866
}

โ€Žsrc/routes/router.tsxโ€Ž

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const CompletedWithdraw = lazy(
3636
)
3737
const AddRecord = lazy(() => import('@pages/AddRecord/AddRecord'))
3838
const DetailRecord = lazy(() => import('@pages/DetailRecord/DetailRecord'))
39+
const WithdrawSignUp = lazy(() => import('@pages/SignUp/WithdrawSignUp'))
3940

4041
const router = createBrowserRouter([
4142
{
@@ -146,17 +147,19 @@ const router = createBrowserRouter([
146147
{
147148
path: 'check',
148149
element: (
149-
<ProtectedRoute route={'/setting/withdraw/check'}>
150-
<CheckedNicknameBeforeWithDraw />
151-
</ProtectedRoute>
150+
<Suspense fallback={<Loading />}>
151+
<ProtectedRoute route={'/setting/withdraw/check'}>
152+
<CheckedNicknameBeforeWithDraw />
153+
</ProtectedRoute>
154+
</Suspense>
152155
),
153156
},
154157
{
155158
path: 'complete',
156159
element: (
157-
<ProtectedRoute route={'/setting/withdraw/complete'}>
160+
<Suspense fallback={<Loading />}>
158161
<CompletedWithdraw />
159-
</ProtectedRoute>
162+
</Suspense>
160163
),
161164
},
162165
],
@@ -187,6 +190,14 @@ const router = createBrowserRouter([
187190
</Suspense>
188191
),
189192
},
193+
{
194+
path: '/sign-up/fail',
195+
element: (
196+
<Suspense fallback={<Loading />}>
197+
<WithdrawSignUp />
198+
</Suspense>
199+
),
200+
},
190201
{
191202
path: '/record/add',
192203
element: (

0 commit comments

Comments
ย (0)