Projeto bot pontos
This commit is contained in:
18
web/components/LogoutButton.tsx
Normal file
18
web/components/LogoutButton.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
"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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user