From cf4efa9298561fc852fe5b1e76dd23c2e9e5a5c6 Mon Sep 17 00:00:00 2001 From: bsilkyn Date: Tue, 21 May 2024 16:44:15 +0200 Subject: [PATCH] chore: actually remove try catch block, because it's not necessary #407 --- .../composables/services/course.service.ts | 40 +++++++++---------- .../composables/services/project.service.ts | 14 +++---- .../services/submission.service.ts | 9 ++--- 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/frontend/src/composables/services/course.service.ts b/frontend/src/composables/services/course.service.ts index 74624bec..e8163519 100644 --- a/frontend/src/composables/services/course.service.ts +++ b/frontend/src/composables/services/course.service.ts @@ -66,28 +66,24 @@ export function useCourses(): CoursesState { const { addSuccessMessage } = useMessagesStore(); const endpoint = endpoints.courses.index; - try { - await create( - endpoint, - { - id: courseData.id, - name: courseData.name, - description: courseData.description, - excerpt: courseData.excerpt, - academic_startyear: courseData.academic_startyear, - private_course: courseData.private_course, - faculty: courseData.faculty?.id, - }, - course, - Course.fromJSON, - ); - addSuccessMessage( - t('toasts.messages.success'), - t('toasts.messages.courses.create.success', [course.value?.name]), - ); - } catch (e) { - console.log(e); - } + await create( + endpoint, + { + id: courseData.id, + name: courseData.name, + description: courseData.description, + excerpt: courseData.excerpt, + academic_startyear: courseData.academic_startyear, + private_course: courseData.private_course, + faculty: courseData.faculty?.id, + }, + course, + Course.fromJSON, + ); + addSuccessMessage( + t('toasts.messages.success'), + t('toasts.messages.courses.create.success', [course.value?.name]), + ); } async function updateCourse(courseData: Course): Promise { diff --git a/frontend/src/composables/services/project.service.ts b/frontend/src/composables/services/project.service.ts index 3bd6e099..89004802 100644 --- a/frontend/src/composables/services/project.service.ts +++ b/frontend/src/composables/services/project.service.ts @@ -101,15 +101,11 @@ export function useProject(): ProjectState { requestData.number_groups = numberOfGroups; } - try { - await create(endpoint, requestData, project, Project.fromJSON, 'multipart/form-data'); - addSuccessMessage( - t('toasts.messages.success'), - t('toasts.messages.projects.create.success', [project.value?.name]), - ); - } catch (e) { - console.log(e); - } + await create(endpoint, requestData, project, Project.fromJSON, 'multipart/form-data'); + addSuccessMessage( + t('toasts.messages.success'), + t('toasts.messages.projects.create.success', [project.value?.name]), + ); } async function updateProject(projectData: Project): Promise { diff --git a/frontend/src/composables/services/submission.service.ts b/frontend/src/composables/services/submission.service.ts index 49bbb756..798e1249 100644 --- a/frontend/src/composables/services/submission.service.ts +++ b/frontend/src/composables/services/submission.service.ts @@ -44,12 +44,9 @@ export function useSubmission(): SubmissionState { uploadedFiles.forEach((file: File) => { formData.append('files', file); // Gebruik 'files' in plaats van 'files[]' }); - try { - await create(endpoint, formData, submission, Submission.fromJSONCreate, 'multipart/form-data'); - addSuccessMessage(t('toasts.messages.success'), t('toasts.messages.submissions.create.success')); - } catch (e) { - console.log(e); - } + + await create(endpoint, formData, submission, Submission.fromJSONCreate, 'multipart/form-data'); + addSuccessMessage(t('toasts.messages.success'), t('toasts.messages.submissions.create.success')); } async function deleteSubmission(id: string): Promise {