Skip to content

Commit

Permalink
logout
Browse files Browse the repository at this point in the history
  • Loading branch information
woo-jk committed Aug 29, 2024
1 parent c280a25 commit d369ace
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/container/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { cn } from '@/utils';
import { usePathname, useRouter } from 'next/navigation';
import { useState } from 'react';
import { Collapsible } from './Collapsible/Collapsible';
import { deleteCookie } from 'cookies-next';

const SIDEBAR_CLASSNAME = {
expanded: 'w-[220px]',
Expand All @@ -21,6 +22,11 @@ export function Sidebar() {
const [myInfoCollapsed, setMyInfoCollapsed] = useState(true);
const [myJDCollapsed, setMyJDCollapsed] = useState(true);

const logout = () => {
deleteCookie('accessToken');
deleteCookie('refreshToken');
router.push('/login');
};
return (
<nav
className={`z-[10000] relative flex flex-col px-[16px] py-[32px] h-screen bg-black ${SIDEBAR_CLASSNAME[expanded ? 'expanded' : 'shrinked']}`}>
Expand Down Expand Up @@ -82,7 +88,13 @@ export function Sidebar() {

<div className="w-full mt-auto flex flex-col items-center gap-[28px]">
{/* <SidebarButton iconName="setting" selected={false} expanded={expanded} expandedText="내 설정" /> */}
<SidebarButton iconName="logout" selected={false} expanded={expanded} expandedText="로그아웃" />
<SidebarButton
iconName="logout"
selected={false}
expanded={expanded}
expandedText="로그아웃"
onClick={logout}
/>
</div>
</nav>
);
Expand Down

0 comments on commit d369ace

Please sign in to comment.