Initial role user app

This commit is contained in:
湛兮
2026-06-02 14:46:39 +08:00
commit 003dc60111
62 changed files with 7835 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
"use client";
import { useRouter } from "next/navigation";
import { LogOut } from "lucide-react";
import { useState } from "react";
export function LogoutButton() {
const router = useRouter();
const [pending, setPending] = useState(false);
async function logout() {
setPending(true);
await fetch("/api/auth/logout", { method: "POST" });
router.replace("/login");
router.refresh();
}
return (
<button className="secondary-button danger" disabled={pending} onClick={logout} type="button">
<LogOut aria-hidden size={18} />
{pending ? "退出中..." : "退出登录"}
</button>
);
}