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.

Location:
jobvista-frontend/src/redux
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • jobvista-frontend/src/redux/actionTypes.js

    rb248810 rbefb988  
    2020export const FETCH_RECRUITERS = "FETCH_RECRUITERS"
    2121export const CHANGE_ACCESS = "CHANGE_ACCESS"
     22export const SUBMIT_RECRUITER_LOGO = "SUBMIT_RECRUITER_LOGO"
     23export const SUBMIT_RECRUITER_COVER = "SUBMIT_RECRUITER_COVER"
     24export const SET_LOGO_URL = 'SET_LOGO_URL';
     25export const SET_PROFILE_PIC_URL = 'SET_PROFILE_PIC_URL';
    2226
    23 
  • jobvista-frontend/src/redux/actions/applicationActions.js

    rb248810 rbefb988  
    4747      }
    4848    },
    49     fetchApplicationsByJobSeeker: (callback) => {
     49    fetchApplicationsByJobSeeker: (jobSeekerId, callback) => {
    5050      return dispatch => {
    51           let currentUser = JSON.parse(localStorage.getItem(CURRENT_USER));
    52           axios.get("/my-applications/" + currentUser.id)
     51          axios.get("/my-applications/" + jobSeekerId)
    5352              .then(response => {
    5453                  dispatch({
  • jobvista-frontend/src/redux/actions/authActions.js

    rb248810 rbefb988  
    4545                //const refreshToken = response.refreshToken;
    4646                const user = {
    47                     id: response.id,
    48                     email: response.email,
    4947                    name: response.name,
    5048                    role: response.role,
    5149                    access: response.hasAccess,
     50                    id: response.id,
    5251                };
    5352                dispatch({
  • jobvista-frontend/src/redux/actions/jobAdvertisementActions.js

    rb248810 rbefb988  
    8787    },
    8888
    89     fetchJobAdvertisementsByRecruiter: (callback) => {
     89    fetchJobAdvertisementsByRecruiter: (recruiterId, callback) => {
    9090        return dispatch => {
    9191            let currentUser = JSON.parse(localStorage.getItem(CURRENT_USER));
    92             axios.get("/job-advertisements/recruiter/" + currentUser.id)
     92            axios.get("/job-advertisements/recruiter/" + recruiterId)
    9393                .then(response => {
    9494                    dispatch({
     
    103103    },
    104104
    105     filterJobAdvertisementsByRecruiter: (filter, callback) => {
     105    filterJobAdvertisementsByRecruiter: (id, filter, callback) => {
    106106
    107107        let currentUser = JSON.parse(localStorage.getItem(CURRENT_USER));
    108         axios.post("/job-advertisements/recruiter/" + currentUser.id + "/filtered", filter)
     108        axios.post("/job-advertisements/recruiter/" + id + "/filtered", filter)
    109109            .then(response => {
    110110                callback(true, response)
     
    116116
    117117    fetchRecruiterDetailsById: (id, callback) => {
    118         axios.get("/recruiter/info/" + id)
     118        axios.get("/recruiter/"+id+"/info")
    119119            .then(response => {
    120120                callback(true, response)
  • jobvista-frontend/src/redux/reducers/authReducer.js

    rb248810 rbefb988  
    33import {isExpired} from "react-jwt";
    44import {CURRENT_USER, SIGN_IN, SIGN_OUT, UPDATE_TOKEN} from "../actionTypes";
     5import {jwtDecode} from "jwt-decode";
    56
    67const initialState = {
     
    1314        case SIGN_IN:
    1415            localStorage.setItem(AUTH_TOKEN, action.payload.token);
    15             localStorage.setItem(CURRENT_USER, JSON.stringify(action.payload.user));
     16            //localStorage.setItem(CURRENT_USER, JSON.stringify(action.payload.user));
    1617            return {
    1718                ...state,
     
    2122        case UPDATE_TOKEN:
    2223            let token = action.payload;
     24            let decodedToken;
    2325            let currentUser = "";
     26            if(token !=null) {
     27                try {
     28                    decodedToken = jwtDecode(token);
     29                } catch (error) {
     30                    console.log("Failed to decode token: " + error)
     31                }
     32            }
     33
    2434            if(!isExpired(token)) {
    2535                localStorage.setItem(AUTH_TOKEN, token);
    26                 currentUser = JSON.parse(localStorage.getItem(CURRENT_USER));
     36                currentUser = {
     37                    name: decodedToken.name,
     38                    role: decodedToken.role,
     39                    access: decodedToken.access,
     40                    id: decodedToken.id
     41                };
    2742            } else {
    28                 localStorage.removeItem(CURRENT_USER);
     43                //localStorage.removeItem(CURRENT_USER);
    2944                localStorage.removeItem(AUTH_TOKEN);
    3045                currentUser = "";
     
    3752            };
    3853        case SIGN_OUT:
    39             localStorage.removeItem(CURRENT_USER);
     54            //localStorage.removeItem(CURRENT_USER);
    4055            localStorage.removeItem(AUTH_TOKEN);
    4156            return {
  • jobvista-frontend/src/redux/reducers/jobAdvertisementReducer.js

    rb248810 rbefb988  
    11import {
    22    ADD_JOB_ADVERTISEMENT,
    3     CURRENT_USER, DELETE_JOB_ADVERTISEMENT, EDIT_JOB_ADVERTISEMENT,
     3    CURRENT_USER,
     4    DELETE_JOB_ADVERTISEMENT,
     5    EDIT_JOB_ADVERTISEMENT,
    46    FETCH_JOB_ADVERTISEMENTS,
    5     FETCH_JOB_ADVERTISEMENTS_BY_RECRUITER, FILTER_JOB_ADVERTISEMENTS, FILTER_JOB_ADVERTISEMENTS_BY_RECRUITER
     7    FETCH_JOB_ADVERTISEMENTS_BY_RECRUITER,
     8    FILTER_JOB_ADVERTISEMENTS,
     9    FILTER_JOB_ADVERTISEMENTS_BY_RECRUITER,
     10    SET_LOGO_URL
    611} from "../actionTypes";
    712import {sortElementsBy} from "../../utils/utils";
  • jobvista-frontend/src/redux/store.js

    rb248810 rbefb988  
    66import adminReducer from "./reducers/adminReducer"
    77import {AdminActions} from "./actions/adminActions";
     8import ImagesReducer from "./reducers/imagesReducer";
    89
    910// const rootReducer = combineReducers({
     
    2122        jobAd: jobAdReducer,
    2223        appl: applicationReducer,
    23         admin: adminReducer
     24        admin: adminReducer,
     25        images: ImagesReducer
    2426    },
    2527});
Note: See TracChangeset for help on using the changeset viewer.