Ignore:
Timestamp:
08/30/24 15:44:27 (4 weeks ago)
Author:
223021 <daniel.ilievski.2@…>
Branches:
main
Parents:
0f0add0
Message:

Implemented Google login, additional file uploads, response messages and email notifications

File:
1 edited

Legend:

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

    r0f0add0 r4d97b63  
    33    CURRENT_USER,
    44    FETCH_APPLICATIONS_BY_JOB_ID,
    5     FETCH_APPLICATIONS_BY_JOB_SEEKER_ID,
    6     SUBMIT_APPLICATION, UPDATE_APPLICATION_STATUS
     5    FETCH_APPLICATIONS_BY_JOB_SEEKER_ID, FILTER_APPLICATIONS_BY_JOB_ID, FILTER_APPLICATIONS_BY_JOB_SEEKER_ID,
     6    SUBMIT_APPLICATION, UPDATE_APPLICATION, UPDATE_APPLICATION_STATUS, UPDATE_APPLICATIONS
    77} from "../actionTypes";
    88
     
    1818                    dispatch({
    1919                        type: SUBMIT_APPLICATION,
     20                        application: response.data
     21                    })
     22                    callback(true, response)
     23                }).catch(error => {
     24                callback(false, error)
     25                console.log(error)
     26            })
     27        }
     28    },
     29
     30    updateApplication: (applicationId, additionalFiles, callback) => {
     31        console.log(additionalFiles)
     32        return dispatch => {
     33            axios.post("/applications/"+ applicationId + "/update", additionalFiles, {
     34                headers: {
     35                    'Content-Type': 'multipart/form-data'
     36                }
     37            })
     38                .then(response => {
     39                    dispatch({
     40                        type: UPDATE_APPLICATION,
    2041                        application: response.data
    2142                    })
     
    4566        }
    4667    },
     68
     69    updateApplications: (changes, callback) => {
     70        return dispatch => {
     71            axios.post("/applications/update", changes)
     72                .then(response => {
     73                    dispatch({
     74                        type: UPDATE_APPLICATIONS,
     75                        applications: response.data
     76                    })
     77                    callback(true, response)
     78                }).catch(error => {
     79                callback(false, error)
     80            })
     81        }
     82    },
     83
    4784    fetchApplicationsByJobSeeker: (jobSeekerId, callback) => {
    4885        return dispatch => {
     
    5188                    dispatch({
    5289                        type: FETCH_APPLICATIONS_BY_JOB_SEEKER_ID,
     90                        applicationsByJobSeeker: response.data
     91                    })
     92                    callback(true, response)
     93                }).catch(error => {
     94                callback(false, error)
     95            })
     96        }
     97    },
     98
     99    filterApplicationsByJobSeeker: (jobSeekerId, status, callback) => {
     100        return dispatch => {
     101            axios.post("/my-applications/" + jobSeekerId + "/filtered", status)
     102                .then(response => {
     103                    dispatch({
     104                        type: FILTER_APPLICATIONS_BY_JOB_SEEKER_ID,
    53105                        applicationsByJobSeeker: response.data
    54106                    })
     
    75127        }
    76128    },
     129
     130    filterApplicationsByJobAdId: (jobAdId, status, callback) => {
     131        return dispatch => {
     132            axios.post("/job-advertisements/" + jobAdId + "/applications/filtered", status)
     133                .then(response => {
     134                        dispatch({
     135                            type: FILTER_APPLICATIONS_BY_JOB_ID,
     136                            applicationsByJobAdId: response.data
     137                        })
     138                        callback(true, response)
     139                    }
     140                ).catch(error => {
     141                callback(false, error)
     142            })
     143        }
     144    },
    77145    downloadResume: (id, callback) => {
    78146        return axios.get("/applications/" + id + "/download-resume", {responseType: "blob"})
     
    86154            })
    87155
     156    },
     157    downloadAdditionalFiles: (id, callback) => {
     158        return axios.get("/applications/" + id + "/download-additional-files")
     159            .then(response => {
     160                const urls = response.data; // This will be a list of URLs
     161                callback(true, urls);
     162            })
     163            .catch(error => {
     164                callback(false, error);
     165            });
     166
    88167    }
    89168}
Note: See TracChangeset for help on using the changeset viewer.