"use client"; import { useSupabase } from "@/app/supabase-provider"; import Button from "@/lib/components/ui/Button"; import Card from "@/lib/components/ui/Card"; import PageHeading from "@/lib/components/ui/PageHeading"; import { useToast } from "@/lib/hooks/useToast"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useState } from "react"; export default function Logout() { const { supabase } = useSupabase(); const [isPending, setIsPending] = useState(false); const { publish } = useToast(); const router = useRouter(); const handleLogout = async () => { setIsPending(true); const { error } = await supabase.auth.signOut(); if (error) { console.error("Error logging out:", error.message); publish({ variant: "danger", text: `Error logging out: ${error.message}`, }); } else { publish({ variant: "success", text: "Logged out successfully", }); router.replace("/"); } setIsPending(false); }; return (

Are you sure you want to sign out?

); }