Skip to content

Commit

Permalink
Upt. 회원 탈퇴 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jee-eun-k committed Jul 6, 2024
1 parent 076602b commit 4657c04
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/pages/settings/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import ListIcon from '@/components/settings/ListIcon';
import UserAvatar from '@/components/settings/UserAvatar';
import { bottomNavigation, stepIndex } from '@/store/common';
import { useNavigate } from 'react-router-dom';
import { useRecoilState, useSetRecoilState } from 'recoil';
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import SettingWrapper from '../auth/common/Wrapper';
import { deleteUser, getInfo, signOut } from '@/api/auth';
import CommonResponse, { removeTokenCookie } from '@/api/http';
Expand All @@ -26,14 +26,15 @@ import { CategoryViewType, categoryViewMode } from '@/store/category';
import { modalAnswer } from '@/constants/message';
import { useModalCommon } from '@/hooks/modalCommon';
import Wrapper from '../auth/common/Wrapper';
import { currentUserInfo } from '@/store/info';

const SettingPage = () => {
const navigation = useNavigate();
const setNavPage = useSetRecoilState(bottomNavigation);

const setStepIndex = useSetRecoilState(stepIndex);
const { showServerError, closeModal } = useModalCommon();

const userInfo = useRecoilValue(currentUserInfo);
const [modalInfo, setModalInfo] = useRecoilState(modalState);
const setCategoryMode = useSetRecoilState<CategoryViewType>(categoryViewMode);

Expand Down Expand Up @@ -98,13 +99,11 @@ const SettingPage = () => {
* handle delete account click event
*/
const deleteAccountClickHandler = async (event: any, reason: any) => {

const res = await (await getInfo()).result;
console.log(res);
removeTokenCookie();
closeModal(event, reason);
navigation('/');
await deleteUser(res)
const authProviderType = userInfo.authProviderType || 'DEFAULT';
await deleteUser(authProviderType)
.then((response: CommonResponse) => {
if (response.status === 'SUCCESS') {
removeTokenCookie();
Expand Down

0 comments on commit 4657c04

Please sign in to comment.