From 543e92a0e91e44d3c8005c122c4da7ba71bc023f Mon Sep 17 00:00:00 2001 From: DongjaJ Date: Sat, 2 Dec 2023 17:19:55 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat(volunteer):=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/volunteer/src/pages/settings/index.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/volunteer/src/pages/settings/index.tsx b/apps/volunteer/src/pages/settings/index.tsx index 443b9758..67c456b6 100644 --- a/apps/volunteer/src/pages/settings/index.tsx +++ b/apps/volunteer/src/pages/settings/index.tsx @@ -1,13 +1,26 @@ -import { Box, VStack } from '@chakra-ui/react'; +import { Box, useToast, VStack } from '@chakra-ui/react'; import { useNavigate } from 'react-router-dom'; import SettingGroup from 'shared/components/SettingGroup'; +import APP_TYPE from 'shared/constants/appType'; +import useAuthStore from 'shared/store/authStore'; +import { removeItemFromStorage } from 'shared/utils/localStorage'; export default function SettingsPage() { const navigate = useNavigate(); const goSettingsAccount = () => navigate('/settings/account'); const goSettingsPassword = () => navigate('/settings/password'); + const { setUser } = useAuthStore(); + const toast = useToast(); const logout = () => { - // TODO: 로그아웃 + setUser(null); + removeItemFromStorage(APP_TYPE.VOLUNTEER_APP); + navigate('/volunteers'); + toast({ + position: 'top', + description: '로그아웃 되었습니다.', + status: 'success', + duration: 1500, + }); }; return ( From 000b1be22bdad411760d014b0b5767385f0c32f0 Mon Sep 17 00:00:00 2001 From: DongjaJ Date: Sat, 2 Dec 2023 17:26:06 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat(shelter):=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/shelter/src/pages/my/index.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/shelter/src/pages/my/index.tsx b/apps/shelter/src/pages/my/index.tsx index 060cb3ba..2f47e8be 100644 --- a/apps/shelter/src/pages/my/index.tsx +++ b/apps/shelter/src/pages/my/index.tsx @@ -1,16 +1,21 @@ -import { Box, Divider, Switch, VStack } from '@chakra-ui/react'; +import { Box, Divider, Switch, useToast, VStack } from '@chakra-ui/react'; import { useNavigate } from 'react-router-dom'; import InfoItem from 'shared/components/InfoItem'; import InfoList from 'shared/components/InfoList'; import InfoTextItem from 'shared/components/InfoTextItem'; import ProfileInfo from 'shared/components/ProfileInfo'; import SettingGroup from 'shared/components/SettingGroup'; +import APP_TYPE from 'shared/constants/appType'; +import useAuthStore from 'shared/store/authStore'; +import { removeItemFromStorage } from 'shared/utils/localStorage'; import { useMyPage } from '@/pages/my/_hooks/useMyPage'; export default function MyPage() { const navigate = useNavigate(); + const { setUser } = useAuthStore(); const { shelterProfile, isAddressPublic, updateAddressStatus } = useMyPage(); + const toast = useToast(); if (!shelterProfile) { return null; @@ -23,7 +28,15 @@ export default function MyPage() { const goSettingsAccount = () => navigate('/settings/account'); const goSettingsPassword = () => navigate('/settings/password'); const logout = () => { - // TODO: 로그아웃 + setUser(null); + removeItemFromStorage(APP_TYPE.SHELTER_APP); + navigate('/signin'); + toast({ + position: 'top', + description: '로그아웃 되었습니다.', + status: 'success', + duration: 1500, + }); }; return (