Files
bot-pontos/web/components/LogoutButton.tsx
2026-10-23 22:31:02 -03:00

19 lines
363 B
TypeScript

"use client";
import { apiFetch } from "@/lib/client-api";
export function LogoutButton() {
async function logout() {
try {
await apiFetch("/auth/logout", { method: "POST" });
} finally {
window.location.href = "/login";
}
}
return (
<button type="button" className="btn link" onClick={logout}>
Sair
</button>
);
}