대시보드 구현
This commit is contained in:
@@ -20,6 +20,12 @@ import {
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const SESSION_RELATED_STORAGE_KEYS = [
|
||||
"session-storage",
|
||||
"auth-storage",
|
||||
"autotrade-kis-runtime-store",
|
||||
] as const;
|
||||
|
||||
interface UserMenuProps {
|
||||
/** Supabase User 객체 */
|
||||
user: User | null;
|
||||
@@ -39,6 +45,18 @@ export function UserMenu({ user, blendWithBackground = false }: UserMenuProps) {
|
||||
|
||||
if (!user) return null;
|
||||
|
||||
/**
|
||||
* @description 로그아웃 제출 직전에 세션 관련 로컬 스토리지를 정리합니다.
|
||||
* @see features/auth/actions.ts signout - 서버 세션 종료를 담당합니다.
|
||||
*/
|
||||
const clearSessionRelatedStorage = () => {
|
||||
if (typeof window === "undefined") return;
|
||||
|
||||
for (const key of SESSION_RELATED_STORAGE_KEYS) {
|
||||
window.localStorage.removeItem(key);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
@@ -91,7 +109,7 @@ export function UserMenu({ user, blendWithBackground = false }: UserMenuProps) {
|
||||
|
||||
<DropdownMenuSeparator />
|
||||
|
||||
<form action={signout}>
|
||||
<form action={signout} onSubmit={clearSessionRelatedStorage}>
|
||||
<DropdownMenuItem asChild>
|
||||
<button className="w-full text-red-600 dark:text-red-400">
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
|
||||
Reference in New Issue
Block a user