로그아웃을 모듈 수준 서버 액션으로 변환 (빌드 간 액션 ID 안정화)

This commit is contained in:
2026-07-05 12:24:48 +09:00
parent c2b1b6169a
commit 65e9b0c5f3
2 changed files with 14 additions and 9 deletions
+10
View File
@@ -0,0 +1,10 @@
"use server";
import { redirect } from "next/navigation";
import { signOut } from "@/auth";
export async function logoutAction() {
await signOut({ redirect: false });
redirect("/login");
}
+4 -9
View File
@@ -8,9 +8,11 @@ import {
LogOut, LogOut,
} from "lucide-react"; } from "lucide-react";
import { auth, signOut } from "@/auth"; import { auth } from "@/auth";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { logoutAction } from "./actions";
const navItems = [ const navItems = [
{ href: "/", label: "대시보드", icon: LayoutDashboard }, { href: "/", label: "대시보드", icon: LayoutDashboard },
{ href: "/maestros", label: "마에스트로", icon: GraduationCap }, { href: "/maestros", label: "마에스트로", icon: GraduationCap },
@@ -63,14 +65,7 @@ export default async function AdminLayout({
ID {session.user.adminID} ID {session.user.adminID}
</p> </p>
</div> </div>
<form <form action={logoutAction}>
action={async () => {
"use server";
await signOut({ redirect: false });
redirect("/login");
}}
>
<Button size="sm" type="submit" variant="outline"> <Button size="sm" type="submit" variant="outline">
<LogOut className="size-4" aria-hidden="true" /> <LogOut className="size-4" aria-hidden="true" />