@@ -2,8 +2,10 @@ import classNames from 'classnames/bind';
2
2
3
3
import { mapoFlowerIsland } from '@/assets/styles/fonts' ;
4
4
import DoughnutChart from '@/features/home/components/DoughnutChart' ;
5
+ import { deleteUser } from '@/shared/apis/auth/delete' ;
5
6
import { Button } from '@/shared/components' ;
6
7
import useAuth from '@/shared/hooks/useAuth' ;
8
+ import useConfirm from '@/shared/hooks/useConfirm' ;
7
9
import { Statistics } from '@/shared/types/record/statistics' ;
8
10
9
11
import styles from './DrawerContents.module.scss' ;
@@ -16,6 +18,7 @@ type DrawerContentsProps = {
16
18
17
19
const DrawerContents = ( { statistics } : DrawerContentsProps ) => {
18
20
const { logout } = useAuth ( ) ;
21
+ const { confirm } = useConfirm ( ) ;
19
22
20
23
const recordsCount = Object ?. values ( statistics ?. recordStatisticsMap ) . reduce (
21
24
( acc , cur ) => acc + cur ,
@@ -26,6 +29,18 @@ const DrawerContents = ({ statistics }: DrawerContentsProps) => {
26
29
window . location . href = 'mailto:[email protected] ' ;
27
30
} ;
28
31
32
+ const handleClickDelete = async ( ) => {
33
+ if (
34
+ await confirm ( {
35
+ message : '정말 회원탈퇴를 하시겠어요?' ,
36
+ okText : '확인' ,
37
+ } )
38
+ ) {
39
+ await deleteUser ( ) ;
40
+ logout ( ) ;
41
+ }
42
+ } ;
43
+
29
44
return (
30
45
< div className = { cx ( 'wrapper' ) } >
31
46
< div className = { cx ( 'title-box' ) } >
@@ -51,11 +66,20 @@ const DrawerContents = ({ statistics }: DrawerContentsProps) => {
51
66
</ div >
52
67
) }
53
68
< div className = { cx ( 'button-container' ) } >
54
- < Button onClick = { onClickContact } > 문의하기</ Button >
55
- < Button type = "outline" onClick = { logout } >
69
+ < Button buttonType = "button" onClick = { onClickContact } >
70
+ 문의하기
71
+ </ Button >
72
+ < Button buttonType = "button" type = "outline" onClick = { logout } >
56
73
로그아웃
57
74
</ Button >
58
75
</ div >
76
+ < button
77
+ type = "button"
78
+ className = { cx ( 'delete-button' ) }
79
+ onClick = { handleClickDelete }
80
+ >
81
+ 회원탈퇴
82
+ </ button >
59
83
</ div >
60
84
) ;
61
85
} ;
0 commit comments