karuracc_dev_test/components/SignOutButton.tsx

22 lines
503 B
TypeScript
Raw Permalink Normal View History

"use client";
import { useRouter } from "next/navigation";
import { createClient } from "@/lib/supabase/client";
export function SignOutButton() {
const router = useRouter();
async function signOut() {
const supabase = createClient();
await supabase.auth.signOut();
router.push("/auth/login");
router.refresh();
}
return (
<button className="btn btn-ghost" style={{ padding: "0.35rem 0.8rem", fontSize: "0.72rem" }} onClick={signOut}>
Sign out
</button>
);
}