mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Replaced redux with zustand. Fixed login issue, closes #980.
This commit is contained in:
parent
7071f5fba5
commit
9937caa569
33 changed files with 234 additions and 286 deletions
|
|
@ -1,17 +1,17 @@
|
|||
import { useEffect } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { useRouter } from 'next/router';
|
||||
import { get } from 'lib/web';
|
||||
import { updateUser } from 'redux/actions/user';
|
||||
import { removeItem } from 'lib/web';
|
||||
import { AUTH_TOKEN } from 'lib/constants';
|
||||
import { setUser } from 'store/app';
|
||||
|
||||
export default function LogoutPage() {
|
||||
const dispatch = useDispatch();
|
||||
const router = useRouter();
|
||||
const { basePath } = router;
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(updateUser(null));
|
||||
get(`${basePath}/api/auth/logout`).then(() => router.push('/login'));
|
||||
removeItem(AUTH_TOKEN);
|
||||
router.push('/login');
|
||||
|
||||
return () => setUser(null);
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue