Skip to content

Commit 9cf5db3

Browse files
committed
feat: 회원탈퇴 버튼 개발 이후 클릭 핸들러 작성
1 parent 0b00340 commit 9cf5db3

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

src/features/home/components/DrawerContents/DrawerContents.module.scss

+7
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,10 @@
7575
height: 110px;
7676
padding: 0 4px;
7777
}
78+
79+
.delete-button {
80+
margin-top: 12px;
81+
@include themes.typography('caption9');
82+
text-decoration: underline;
83+
font-weight: 300;
84+
}

src/features/home/components/DrawerContents/DrawerContents.tsx

+26-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import classNames from 'classnames/bind';
22

33
import { mapoFlowerIsland } from '@/assets/styles/fonts';
44
import DoughnutChart from '@/features/home/components/DoughnutChart';
5+
import { deleteUser } from '@/shared/apis/auth/delete';
56
import { Button } from '@/shared/components';
67
import useAuth from '@/shared/hooks/useAuth';
8+
import useConfirm from '@/shared/hooks/useConfirm';
79
import { Statistics } from '@/shared/types/record/statistics';
810

911
import styles from './DrawerContents.module.scss';
@@ -16,6 +18,7 @@ type DrawerContentsProps = {
1618

1719
const DrawerContents = ({ statistics }: DrawerContentsProps) => {
1820
const { logout } = useAuth();
21+
const { confirm } = useConfirm();
1922

2023
const recordsCount = Object?.values(statistics?.recordStatisticsMap).reduce(
2124
(acc, cur) => acc + cur,
@@ -26,6 +29,18 @@ const DrawerContents = ({ statistics }: DrawerContentsProps) => {
2629
window.location.href = 'mailto:[email protected]';
2730
};
2831

32+
const handleClickDelete = async () => {
33+
if (
34+
await confirm({
35+
message: '정말 회원탈퇴를 하시겠어요?',
36+
okText: '확인',
37+
})
38+
) {
39+
await deleteUser();
40+
logout();
41+
}
42+
};
43+
2944
return (
3045
<div className={cx('wrapper')}>
3146
<div className={cx('title-box')}>
@@ -51,11 +66,20 @@ const DrawerContents = ({ statistics }: DrawerContentsProps) => {
5166
</div>
5267
)}
5368
<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}>
5673
로그아웃
5774
</Button>
5875
</div>
76+
<button
77+
type="button"
78+
className={cx('delete-button')}
79+
onClick={handleClickDelete}
80+
>
81+
회원탈퇴
82+
</button>
5983
</div>
6084
);
6185
};

0 commit comments

Comments
 (0)