Ignore:
Timestamp:
01/13/24 23:19:50 (6 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/Components/Layout/Navbar/Navigation.js

    re9b4ba9 rac19a0c  
    77import useGet from "../../Hooks/useGet";
    88import axios from "../../../axios.js";
     9import {useAuth} from "../../Context/AuthContext";
    910//import logo from 'assets/images/logo.png';
    1011//src="https://upload.wikimedia.org/wikipedia/commons/0/08/Vergina_Sun_-_Golden_Larnax.png"
     
    1213function Navigation(props) {
    1314  const navigator = useNavigate();
    14 
    15   const { data, setData, isLoading, getData } = useGet("/username");
    16  
     15  const Auth = useAuth();
     16  const isLoggedIn = Auth.userIsAuthenticated();
    1717  return (
    1818    <>
     
    2424      >
    2525        <Container>
    26           <Navbar.Brand href="#home">
     26          <Navbar.Brand href="/home">
    2727            <span className="ikona">
    2828              <Image
     
    5050                Pricing
    5151              </Nav.Link>
    52               {!isLoading && !data && (
     52              {!isLoggedIn && (
    5353                <Button
    5454                  className="m-2"
     
    6262                </Button>
    6363              )}
    64               {!isLoading && data && (
     64              {isLoggedIn && (
    6565                <>
    6666                  <Nav.Link className="m-2" href="/profile">
    67                     {data}
     67                    {Auth.getUser().username}
    6868                  </Nav.Link>
    6969                  <Button
     
    7474                      await axios.get("/logout")
    7575                      .then((res) => {
    76                         console.log(res)
     76                        console.log(res);
     77                        Auth.userLogout();
    7778                      })
    7879                      .catch((err) => {
Note: See TracChangeset for help on using the changeset viewer.