"use client"; import Button from "@/app/components/ui/Button"; import Card from "@/app/components/ui/Card"; import PageHeading from "@/app/components/ui/PageHeading"; import { useSupabase } from "@/app/supabase-provider"; 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?

); }