mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-27 12:55:45 +01:00
Reset user in redux on logout.
This commit is contained in:
parent
b4ed29be3c
commit
0de874f7a0
@ -1,12 +1,16 @@
|
||||
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';
|
||||
|
||||
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'));
|
||||
}, []);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user