Ignore:
Timestamp:
06/17/24 21:59:14 (2 weeks ago)
Author:
223021 <daniel.ilievski.2@…>
Branches:
main
Children:
08f82ec
Parents:
b248810
Message:

Added an edit profile page for both job seekers and recruiters, where they can upload profile pictures/company logos and edit their profile data. Added profile page specifically for recruiters. Refactored existing code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jobvista-frontend/src/App.js

    rb248810 rbefb988  
    44import {BrowserRouter} from "react-router-dom";
    55import {Header} from "./views/static/Header";
    6 import {RoutesConfig} from "./auth/RoutesConfig";
    7 import {useEffect, useState} from "react";
     6import RoutesConfig from "./auth/RoutesConfig";
     7import React, {useEffect, useState} from "react";
    88import {AuthActions} from "./redux/actions/authActions";
    99import {AUTH_TOKEN} from "./axios/axiosInstance";
    1010import {jwtDecode} from "jwt-decode";
    1111import {NoAccess} from "./views/static/NoAccess";
     12import {Loading} from "./views/static/Loading";
     13import {ToastContainer} from "react-toastify";
    1214
    1315function App() {
     
    2022    const [user, setUser] = useState(null);
    2123    const [loading, setLoading] = useState(true);
     24    const [minimumLoadingTime, setMinimumLoadingTime] = useState(true);
     25
    2226    const auth = useSelector(state => state.auth);
     27
     28    useEffect(() => {
     29        // Simulate a minimum loading time of 1 second
     30        const timer = setTimeout(() => {
     31            setMinimumLoadingTime(false);
     32        }, 1000);
     33
     34        // Clear timeout if component unmounts
     35        return () => clearTimeout(timer);
     36    }, []);
    2337
    2438    useEffect(() => {
     
    3044                    name: decodedToken.name,
    3145                    role: decodedToken.role,
    32                     hasAccess: auth.currentUser.access,
     46                    hasAccess: decodedToken.access,
     47                    id: decodedToken.id
    3348                });
    3449                setLoading(false);
     
    4257    }, [auth]);
    4358
    44     if (loading) {
    45         return <NoAccess />; // Replace LoadingSpinner with your loading indicator component
     59    if (loading || minimumLoadingTime) {
     60        return <Loading />; // Replace LoadingSpinner with your loading indicator component
    4661    }
    4762
     
    5873                      <Header />
    5974                      <RoutesConfig />
     75                      {/*<Loading/>*/}
    6076                  </>
    6177              ) : (
    6278                  <NoAccess user={user}/>
    6379              )}
    64 
    65 
    6680          </BrowserRouter>
     81          <ToastContainer/>
    6782      </div>
    6883  );
Note: See TracChangeset for help on using the changeset viewer.