2024-04-06 01:08:52 +08:00
|
|
|
"use client";
|
2024-04-06 02:35:31 +08:00
|
|
|
import { signout } from "@/lib/actions/auth";
|
2024-04-06 01:08:52 +08:00
|
|
|
import { usePathname } from "next/navigation";
|
2024-04-05 15:35:01 +08:00
|
|
|
|
2024-04-06 01:08:52 +08:00
|
|
|
export default function SignoutButton({
|
|
|
|
className,
|
|
|
|
}: {
|
|
|
|
className: string | undefined;
|
|
|
|
}) {
|
|
|
|
const pathname = usePathname();
|
|
|
|
if (pathname.match("/signin") || pathname.match("/signup")) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
className={className}
|
|
|
|
onClick={async () => {
|
2024-04-05 15:35:01 +08:00
|
|
|
await signout();
|
2024-04-06 01:08:52 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
注销
|
2024-04-05 15:35:01 +08:00
|
|
|
</button>
|
2024-04-06 01:08:52 +08:00
|
|
|
);
|
|
|
|
}
|