mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Implement redux.
This commit is contained in:
parent
9d8a2406e1
commit
5d4ff5cfa4
31 changed files with 341 additions and 85 deletions
|
|
@ -1,27 +1,9 @@
|
|||
import React from 'react';
|
||||
import { serialize } from 'cookie';
|
||||
import Layout from 'components/Layout';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export default function LogoutPage() {
|
||||
return (
|
||||
<Layout title="Logout">
|
||||
<h2>You've successfully logged out..</h2>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ res }) {
|
||||
const cookie = serialize('umami.auth', '', {
|
||||
path: '/',
|
||||
httpOnly: true,
|
||||
maxAge: 0,
|
||||
});
|
||||
|
||||
res.statusCode = 303;
|
||||
res.setHeader('Set-Cookie', [cookie]);
|
||||
res.setHeader('Location', '/login');
|
||||
|
||||
res.end();
|
||||
|
||||
return { props: {} };
|
||||
useEffect(() => {
|
||||
fetch('/api/auth/logout').then(() => (window.location.href = '/login'));
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue