aboutsummaryrefslogtreecommitdiff
path: root/src/app/logout/LogoutPage.tsx
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-24 13:09:50 +0000
committerFuwn <[email protected]>2026-01-24 13:09:50 +0000
commit396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b (patch)
treeb9df4ca6a70db45cfffbae6fdd7252e20fb8e93c /src/app/logout/LogoutPage.tsx
downloadumami-main.tar.xz
umami-main.zip
Initial commitHEADmain
Created from https://vercel.com/new
Diffstat (limited to 'src/app/logout/LogoutPage.tsx')
-rw-r--r--src/app/logout/LogoutPage.tsx25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/app/logout/LogoutPage.tsx b/src/app/logout/LogoutPage.tsx
new file mode 100644
index 0000000..33e1615
--- /dev/null
+++ b/src/app/logout/LogoutPage.tsx
@@ -0,0 +1,25 @@
+'use client';
+import { useRouter } from 'next/navigation';
+import { useEffect } from 'react';
+import { useApi } from '@/components/hooks';
+import { removeClientAuthToken } from '@/lib/client';
+import { setUser } from '@/store/app';
+
+export function LogoutPage() {
+ const router = useRouter();
+ const { post } = useApi();
+
+ useEffect(() => {
+ async function logout() {
+ await post('/auth/logout');
+
+ window.location.href = `${process.env.basePath || ''}/login`;
+ }
+
+ removeClientAuthToken();
+ setUser(null);
+ logout();
+ }, [router, post]);
+
+ return null;
+}