refactor: guest mode

This commit is contained in:
Tristan Yang
2022-09-02 12:39:40 +08:00
parent 333cbb8b4b
commit c4435662c0
8 changed files with 50 additions and 26 deletions
+15
View File
@@ -0,0 +1,15 @@
// import { useEffect } from "react";
import { Navigate } from "react-router-dom";
import { useGuestLoginQuery } from "../app/services/auth";
import { useAppSelector } from "../app/store";
// type Props = {};
const GuestLogining = () => {
useGuestLoginQuery();
const { token, guest } = useAppSelector((store) => store.authData);
if (token && guest) return <Navigate to={"/"} replace />;
return null;
};
export default GuestLogining;