25 lines
477 B
TypeScript
25 lines
477 B
TypeScript
"use client";
|
|
import { signout } from "@/lib/actions/auth";
|
|
import { usePathname } from "next/navigation";
|
|
|
|
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 () => {
|
|
await signout();
|
|
}}
|
|
>
|
|
注销
|
|
</button>
|
|
);
|
|
}
|