Skip to content

Commit

Permalink
[fix] 로그아웃 모달 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
zestlee1106 committed Dec 20, 2023
1 parent 715d823 commit 77ea6fd
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions components/ProfileCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function ProfileCard({ imageSrc, userInfo }: ProfileCard) {
const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
const age = formatAge(userInfo?.birthDate || '');
const router = useRouter();
const { openModal } = useModal();
const { openModal, closeModal } = useModal();

const handleRouting = (route: string) => {
if (route === '/') {
Expand Down Expand Up @@ -95,16 +95,26 @@ export default function ProfileCard({ imageSrc, userInfo }: ProfileCard) {
</div>
);

const handleLogout = () => {
setShowModal(true);
};

const doLogout = () => {
signOut({
callbackUrl: '/',
});
};

const handleLogout = () => {
openModal({
props: {
title: 'Log out of Ko-Living?',
content: 'You can log back in at anytime.',
buttonType: 'both',
buttonName: 'Cancel',
buttonName2: 'Log out',
handleClose: () => closeModal(),
handleSecondButton: () => doLogout(),
},
});
};

const items = [
{ IconComponent: MyPosting, text: 'My postings', route: '/userInfo/myPostings' },
{ IconComponent: ChangePassword, text: 'Change password', route: '/resetPassword/step1' },
Expand Down Expand Up @@ -149,18 +159,6 @@ export default function ProfileCard({ imageSrc, userInfo }: ProfileCard) {
className="bg-r1 mb-[20px] h-[120px] text-[14px]"
readonly
/>

{showModal && (
<ModalBox
title="Log out of Ko-Living?"
content="You can log back in at anytime."
buttonType="both"
buttonName="Cancel"
buttonName2="Log out"
handleClose={() => setShowModal(false)}
handleSecondButton={() => doLogout()}
/>
)}
</div>
<ListContainer />
<hr className="mt-[345px]" />
Expand Down

0 comments on commit 77ea6fd

Please sign in to comment.