feat : update
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { usePathname } from "next/navigation";
|
||||
import {
|
||||
ExternalLinkIcon,
|
||||
ImageIcon,
|
||||
@@ -10,30 +10,16 @@ import {
|
||||
BookOpenIcon,
|
||||
ClipboardListIcon,
|
||||
MessagesSquareIcon,
|
||||
LogOutIcon,
|
||||
PlusIcon,
|
||||
SwordsIcon,
|
||||
} from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { authClient } from "@/lib/auth/client";
|
||||
import { unsubscribeCommissionPush } from "@/components/commission/push-client";
|
||||
import { AccountMenu } from "@/components/auth/account-menu";
|
||||
import { CommissionPushEntryPrompt } from "@/components/commission/push-entry-prompt";
|
||||
|
||||
export function AdminHeader() {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const signOut = async () => {
|
||||
await unsubscribeCommissionPush().catch(() => undefined);
|
||||
await authClient.signOut({
|
||||
fetchOptions: {
|
||||
onSuccess: () => {
|
||||
router.push("/admin/login");
|
||||
router.refresh();
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (<>
|
||||
<CommissionPushEntryPrompt scope="admin" />
|
||||
@@ -123,14 +109,7 @@ export function AdminHeader() {
|
||||
>
|
||||
<ExternalLinkIcon />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
aria-label="ออกจากระบบ"
|
||||
onClick={signOut}
|
||||
>
|
||||
<LogOutIcon />
|
||||
</Button>
|
||||
<AccountMenu admin />
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user