"use client"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { api } from "@/lib/api"; export function LogoutButton() { const router = useRouter(); const [busy, setBusy] = useState(false); async function logout() { setBusy(true); try { await api("/auth/logout", { method: "POST" }); } catch { // The session may already be gone; go to the login page either way. } window.google?.accounts.id.disableAutoSelect(); router.replace("/belepes"); router.refresh(); } return ( ); }