Changeset 08f82ec for jobvista-frontend/src/redux
- Timestamp:
- 06/20/24 11:57:13 (5 months ago)
- Branches:
- main
- Children:
- 0f0add0
- Parents:
- befb988
- Location:
- jobvista-frontend/src/redux
- Files:
-
- 3 added
- 2 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 } -
jobvista-frontend/src/redux/actions/jobAdvertisementActions.js
rbefb988 r08f82ec 10 10 addJobAdvertisement: (jobAdvertisement, callback) => { 11 11 return dispatch => { 12 axios.post("/job-advertisements/add", jobAdvertisement, { 13 headers: { 14 'Content-Type': 'application/json' 15 }, 16 }) 12 axios.post("/job-advertisements/add", jobAdvertisement) 17 13 .then(response => { 18 14 dispatch({ … … 20 16 jobAdvertisement: response.data 21 17 }) 22 callback(true , response)18 callback(true) 23 19 }).catch((error) => { 24 callback(false, error) 20 console.error(error) 21 callback(false) 25 22 }) 26 23 } … … 34 31 jobAdvertisement: response.data 35 32 }) 36 callback(true , response)33 callback(true) 37 34 }).catch((error) => { 38 callback(false, error) 35 console.error(error) 36 callback(false) 39 37 }) 40 38 } … … 50 48 callback(true) 51 49 }).catch(error => { 52 callback(false, error) 50 console.error(error) 51 callback(false) 53 52 }) 54 53 … … 83 82 callback(true, response) 84 83 }).catch((error) => { 85 callback(false, error) }) 84 callback(false, error) 85 }) 86 86 87 87 }, … … 96 96 jobAdvertisementsByRecruiter: response.data, 97 97 }) 98 callback(true, response) 99 }).catch((error) => { 100 callback(false, error) 101 }) 102 } 103 }, 104 105 fetchJobAdvertisementsByRecruiterProfile: (recruiterId, callback) => { 106 return dispatch => { 107 let currentUser = JSON.parse(localStorage.getItem(CURRENT_USER)); 108 axios.get("/job-advertisements/recruiter/" + recruiterId) 109 .then(response => { 98 110 callback(true, response) 99 111 }).catch((error) => { … … 116 128 117 129 fetchRecruiterDetailsById: (id, callback) => { 118 axios.get("/recruiter/" +id+"/info")130 axios.get("/recruiter/" + id + "/info") 119 131 .then(response => { 120 132 callback(true, response)
Note:
See TracChangeset
for help on using the changeset viewer.