From ad8cbd5b318c9944f0294f8c8b005de3dec8cdea Mon Sep 17 00:00:00 2001 From: Avisha Sodhi <38086281+SodhiA1@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:15:33 -0800 Subject: [PATCH] EDX-3045: Bug fix --- backend/src/components/sdc/sdc.js | 7 ++----- .../components/data-collection/AllStudents/EditStudent.vue | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/src/components/sdc/sdc.js b/backend/src/components/sdc/sdc.js index 64ef6ec2..2d0aaf38 100644 --- a/backend/src/components/sdc/sdc.js +++ b/backend/src/components/sdc/sdc.js @@ -682,11 +682,8 @@ async function updateAndValidateSdcSchoolCollectionStudent(req, res) { status: HttpStatus.CONFLICT, message: 'The student you are attempting to update is already being saved by another user. Please refresh your screen and try again.' }); - } else if (e.status === 400 && e.data.message === 'SdcSchoolCollectionStudent was not saved to the database because it would create a provincial duplicate.') { - return res.status(HttpStatus.CONFLICT).json({ - status: HttpStatus.CONFLICT, - message: 'Student was not saved because it would create provincial a duplicate.' - }); + } else if (e?.status === 400) { + return res.status(HttpStatus.BAD_REQUEST).json(e?.data?.message); } return handleExceptionResponse(e, res); } diff --git a/frontend/src/components/data-collection/AllStudents/EditStudent.vue b/frontend/src/components/data-collection/AllStudents/EditStudent.vue index 300544ff..6ed1657f 100644 --- a/frontend/src/components/data-collection/AllStudents/EditStudent.vue +++ b/frontend/src/components/data-collection/AllStudents/EditStudent.vue @@ -764,7 +764,7 @@ export default { } }).catch(error => { console.error(error); - setFailureAlert(error?.response?.data?.message ? error?.response?.data?.message : 'An error occurred while trying to update student details. Please try again later.'); + setFailureAlert(error?.response?.data ? error?.response?.data : 'An error occurred while trying to update student details. Please try again later.'); }).finally(() => { this.loadingCount -= 1; this.$emit('reset-parent');