feat: add logout page
This commit is contained in:
parent
a7f8ddd1cb
commit
47ed36d24c
1 changed files with 19 additions and 0 deletions
19
frontend/pages/logout.tsx
Normal file
19
frontend/pages/logout.tsx
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { useRecoilState } from "recoil";
|
||||||
|
import Loading from "../components/Loading";
|
||||||
|
import { userState } from "../lib/state";
|
||||||
|
|
||||||
|
export default function Logout() {
|
||||||
|
const router = useRouter();
|
||||||
|
const [_, setUser] = useRecoilState(userState);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
localStorage.removeItem("pronouns-token");
|
||||||
|
setUser(null);
|
||||||
|
|
||||||
|
router.push("/");
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return <Loading />;
|
||||||
|
}
|
Loading…
Reference in a new issue