- Timestamp:
- 06/20/24 11:57:13 (3 months ago)
- Branches:
- main
- Children:
- 0f0add0
- Parents:
- befb988
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
jobvista-frontend/src/redux/actions/applicationActions.js
rbefb988 r08f82ec 10 10 submitApplication: (application, callback) => { 11 11 return dispatch => { 12 axios.post("/ job-advertisements/apply", application, {12 axios.post("/applications/submit", application, { 13 13 headers: { 14 14 'Content-Type': 'multipart/form-data' … … 26 26 }) 27 27 } 28 29 28 }, 30 29 updateApplicationStatus: (id, status, callback) => { 31 30 console.log(status) 32 return dispatch => { 33 // TO DO: REFACTOR 34 axios.post("/applications/" + id + "/update", { 35 id: id, 36 status: status 37 }) 38 .then(response => { 39 dispatch({ 40 type: UPDATE_APPLICATION_STATUS, 41 application: response.data, 42 }) 43 callback(true, response) 44 }).catch(error => { 45 callback(false, error) 46 }) 47 } 31 return dispatch => { 32 axios.post("/applications/" + id + "/update", { 33 id: id, 34 status: status 35 }) 36 .then(response => { 37 dispatch({ 38 type: UPDATE_APPLICATION_STATUS, 39 application: response.data, 40 }) 41 callback(true, response) 42 }).catch(error => { 43 callback(false, error) 44 }) 45 } 48 46 }, 49 47 fetchApplicationsByJobSeeker: (jobSeekerId, callback) => { 50 return dispatch => {51 axios.get("/my-applications/" + jobSeekerId)52 .then(response => {53 dispatch({54 type: FETCH_APPLICATIONS_BY_JOB_SEEKER_ID,55 applicationsByJobSeeker: response.data56 })57 callback(true, response)58 }).catch(error => {59 60 })61 }48 return dispatch => { 49 axios.get("/my-applications/" + jobSeekerId) 50 .then(response => { 51 dispatch({ 52 type: FETCH_APPLICATIONS_BY_JOB_SEEKER_ID, 53 applicationsByJobSeeker: response.data 54 }) 55 callback(true, response) 56 }).catch(error => { 57 callback(false, error) 58 }) 59 } 62 60 }, 63 61 … … 77 75 } 78 76 }, 79 downloadResume: (fileName, callback) => { 80 return dispatch => { 81 return axios.get("/resume/" + fileName, {responseType: "blob"}) 82 .then(response => { 83 const blob = new Blob([response.data], { type: 'application/pdf' }); 84 const url = window.URL.createObjectURL(blob); 85 callback(true, url); 86 }) 77 downloadResume: (id, callback) => { 78 return axios.get("/applications/" + id + "/download-resume", {responseType: "blob"}) 79 .then(response => { 80 const blob = new Blob([response.data], {type: 'application/pdf'}); 81 const url = window.URL.createObjectURL(blob); 82 callback(true, url); 83 }) 84 .catch(error => { 85 callback(false, error) 86 }) 87 87 88 .catch(error => {89 callback(false, error)90 })91 }92 88 } 93 89 }
Note:
See TracChangeset
for help on using the changeset viewer.