adding route for sign up and such
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Route, useNavigate } from "react-router-dom";
|
||||
|
||||
import { STORE_ITEMS } from "../../electron/store";
|
||||
import { nirvanaApi } from "../../controller/nirvanaApi";
|
||||
import { useEffect } from "react";
|
||||
import { useGetUserDetails } from "../../controller/index";
|
||||
|
||||
@@ -9,18 +10,18 @@ export default function ProtectedRoute({ ...children }) {
|
||||
|
||||
useEffect(() => {
|
||||
// console.log(window.electronAPI.store.get(STORE_ITEMS.AUTH_TOKENS));
|
||||
// nirvanaApi.getUserDetails();
|
||||
}, []);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
if (isLoading) return <span>please wait while we authenticate you</span>;
|
||||
|
||||
if (isError) {
|
||||
// toast.error("Please sign in first!");
|
||||
navigate("/login");
|
||||
|
||||
return <span>you are not allowed here!</span>;
|
||||
}
|
||||
useEffect(() => {
|
||||
if (isError) {
|
||||
navigate("/login");
|
||||
}
|
||||
}, [isError]);
|
||||
|
||||
// if we can successfully get user details, we are good to continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user