Skip to content

Commit

Permalink
chore: actually remove try catch block, because it's not necessary #407
Browse files Browse the repository at this point in the history
  • Loading branch information
bsilkyn committed May 21, 2024
1 parent 54305f3 commit cf4efa9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 37 deletions.
40 changes: 18 additions & 22 deletions frontend/src/composables/services/course.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,24 @@ export function useCourses(): CoursesState {
const { addSuccessMessage } = useMessagesStore();

const endpoint = endpoints.courses.index;
try {
await create<Course>(
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<Course>(
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<void> {
Expand Down
14 changes: 5 additions & 9 deletions frontend/src/composables/services/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,11 @@ export function useProject(): ProjectState {
requestData.number_groups = numberOfGroups;
}

try {
await create<Project>(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<Project>(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<void> {
Expand Down
9 changes: 3 additions & 6 deletions frontend/src/composables/services/submission.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
Expand Down

0 comments on commit cf4efa9

Please sign in to comment.