Files
HaBit/components/logout-button.tsx
2026-05-23 21:23:39 -06:00

21 lines
482 B
TypeScript

"use client";
import { useRouter } from "next/navigation";
import { Button } from "@/components/ui/button";
import { createClient } from "@/lib/supabase/client";
import { routes } from "@/lib/routes";
export function LogoutButton() {
const router = useRouter();
const logout = async () => {
const supabase = createClient();
await supabase.auth.signOut();
router.push(routes.home);
router.refresh();
};
return <Button onClick={logout}>Logout</Button>;
}