adding route for sign up and such

This commit is contained in:
talksik
2022-03-17 21:42:03 -04:00
parent 444c116f1b
commit 4b2a7f7043
14 changed files with 120 additions and 68 deletions
@@ -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