my-fullstack-ai-platform/components/logout-button.tsx

18 lines
422 B
TypeScript
Raw Permalink Normal View History

2026-04-04 20:00:53 +00:00
"use client";
import { createClient } from "@/lib/supabase/client";
import { Button } from "@/components/ui/button";
import { useRouter } from "next/navigation";
export function LogoutButton() {
const router = useRouter();
const logout = async () => {
const supabase = createClient();
await supabase.auth.signOut();
router.push("/auth/login");
};
return <Button onClick={logout}>Logout</Button>;
}