text: import React, { useState, useEffect } from "react";
  import { Switch, Route, Link } from "react-router-dom";
  import "bootstrap/dist/css/bootstrap.min.css";
  import "./App.css";
  
  import AuthService from "./services/auth.service";
  import addImage from './assets/images/add.png'
  import Login from "./components/Login";
  import Register from "./components/Register";
  import Home from "./components/Home";
  import PostImage from "./components/PostImage";
  const App = () => {
    const [currentUser, setCurrentUser] = useState(undefined);
  
    useEffect(() => {
      const user = AuthService.getCurrentUser();
  
      if (user) {
        setCurrentUser(user);
      }
    }, []);
  
    const logOut = () => {
      AuthService.logout();
    };
  
    return (
      <div>
        <nav className="navbar navbar-expand navbar-dark bg-dark">
          <Link to={"/"} className="navbar-brand">
            InstaPic
          </Link>
          <div className="navbar-nav mr-auto">
            <li className="nav-item">
              <Link to={"/post"} className="nav-link">
                {/* <img style={{width:32}} src={addImage} /> */}
                Profile
              </Link>
            </li>
          </div>
  
          {currentUser ? (
            <div className="navbar-nav ml-auto">
              <li className="nav-item">
                <a href="/login" className="nav-link" onClick={logOut}>
                  LogOut
                </a>
              </li>
            </div>
          ) : (
              <div className="navbar-nav ml-auto">
                <li className="nav-item">
                  <Link to={"/login"} className="nav-link">
                    Login
                </Link>
                </li>
  
                <li className="nav-item">
                  <Link to={"/register"} className="nav-link">
                    Sign Up
                </Link>
                </li>
              </div>
            )}
        </nav>
  
        <div className="container mt-3">
          <Switch>
            <Route exact path={["/", "/home"]} component={Home} />
            <Route exact path="/login" component={Login} />
            <Route exact path="/register" component={Register} />
            <Route exact path="/post" component={PostImage} />
          </Switch>
        </div>
      </div>
    );
  };
  
  export default App;
  