Changeset 4d97b63 for jobvista-frontend/src/redux/actions
- Timestamp:
- 08/30/24 15:44:27 (3 months ago)
- Branches:
- main
- Parents:
- 0f0add0
- Location:
- jobvista-frontend/src/redux/actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
jobvista-frontend/src/redux/actions/applicationActions.js
r0f0add0 r4d97b63 3 3 CURRENT_USER, 4 4 FETCH_APPLICATIONS_BY_JOB_ID, 5 FETCH_APPLICATIONS_BY_JOB_SEEKER_ID, 6 SUBMIT_APPLICATION, UPDATE_APPLICATION _STATUS5 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 7 7 } from "../actionTypes"; 8 8 … … 18 18 dispatch({ 19 19 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, 20 41 application: response.data 21 42 }) … … 45 66 } 46 67 }, 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 47 84 fetchApplicationsByJobSeeker: (jobSeekerId, callback) => { 48 85 return dispatch => { … … 51 88 dispatch({ 52 89 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, 53 105 applicationsByJobSeeker: response.data 54 106 }) … … 75 127 } 76 128 }, 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 }, 77 145 downloadResume: (id, callback) => { 78 146 return axios.get("/applications/" + id + "/download-resume", {responseType: "blob"}) … … 86 154 }) 87 155 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 88 167 } 89 168 } -
jobvista-frontend/src/redux/actions/authActions.js
r0f0add0 r4d97b63 32 32 }).catch((error) => { 33 33 callback(false, error); 34 }); 35 }; 36 }, 37 38 signInGoogle: (tokenId, callback) => { 39 return dispatch => { 40 axios.post("/auth/google", { tokenId }) 41 .then(jwtResponse => { 42 const response = jwtResponse.data; 43 const token = response.token; 44 const user = { 45 name: response.name, 46 role: response.role, 47 access: response.hasAccess, 48 id: response.id, 49 }; 50 dispatch({ 51 type: SIGN_IN, 52 payload: { 53 token, 54 user 55 } 56 }); 57 callback && callback(true); 58 }).catch(error => { 59 callback && callback(false, error); 34 60 }); 35 61 };
Note:
See TracChangeset
for help on using the changeset viewer.