diff --git a/frontend/pages/logout.tsx b/frontend/pages/logout.tsx new file mode 100644 index 0000000..695a0e5 --- /dev/null +++ b/frontend/pages/logout.tsx @@ -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 ; +}