Ignore:
Timestamp:
01/13/24 23:19:50 (9 months ago)
Author:
darsov2 <62809499+darsov2@…>
Branches:
master
Children:
e85a562
Parents:
e9b4ba9
Message:

authContext impl, admin panel impl, search bar fixes, reservations listings impl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • frontend/src/Pages/NoBusinessRegisteredError.js

    re9b4ba9 rac19a0c  
    66import RegisterBusinessForm from "../Components/Forms/RegisterBusinessForm";
    77import useGet from "../Components/Hooks/useGet";
    8 import { useNavigate } from "react-router-dom";
     8import {Navigate, useNavigate} from "react-router-dom";
     9import {useAuth} from "../Components/Context/AuthContext";
    910
    1011const NoBusinessRegisteredError = (props) => {
    1112  const [show, setShow] = useState(false);
    1213  const [changed, setChanged] = useState(0);
    13   const {data, isLoading} = useGet("/username")
     14  const Auth = useAuth();
     15  const isLoggedIn = Auth.userIsAuthenticated();
    1416  const userId = localStorage.getItem("userId")
    1517  const [registered, setRegistered] = useState(false);
     
    4547
    4648
    47   console.log(data)
     49  if(!isLoggedIn)
     50  {
     51    return <Navigate to={'/login'}/>
     52  }
    4853
    49   !isLoading && !data && navigator("/login")
    5054  !firmaIsLoading && firma && firma.length > 0 && firma[0].approved && navigator("/resources/hotel")
    5155 
Note: See TracChangeset for help on using the changeset viewer.