From 7b283624c796d2843eb711b3bd4751a42d721f40 Mon Sep 17 00:00:00 2001 From: bsilkyn Date: Sat, 18 May 2024 17:17:00 +0200 Subject: [PATCH] chore: make general for now #407 --- frontend/src/assets/lang/app/en.json | 2 +- frontend/src/assets/lang/app/nl.json | 2 +- frontend/src/composables/services/helpers.ts | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/assets/lang/app/en.json b/frontend/src/assets/lang/app/en.json index 9c0e7aaa..28db6a9f 100644 --- a/frontend/src/assets/lang/app/en.json +++ b/frontend/src/assets/lang/app/en.json @@ -222,7 +222,7 @@ "success": "Success", "error": "Error", "unknown": "An unknown error has occurred.", - "create": "The {type} has successfully been created", + "create": "The object has successfully been created", "courses": { "enrollment": { "success": "You have been successfully enrolled for the course '{0}'.", diff --git a/frontend/src/assets/lang/app/nl.json b/frontend/src/assets/lang/app/nl.json index 70c47ad8..0a11c5a7 100644 --- a/frontend/src/assets/lang/app/nl.json +++ b/frontend/src/assets/lang/app/nl.json @@ -219,7 +219,7 @@ "success": "Succes", "error": "Fout", "unknown": "Er is een onbekende fout opgetreden.", - "create": "De {type} werd succesvol aangemaakt", + "create": "Het object werd succesvol aangemaakt", "courses": { "enrollment": { "success": "Je bent succesvol ingeschreven voor het vak '{0}'.", diff --git a/frontend/src/composables/services/helpers.ts b/frontend/src/composables/services/helpers.ts index 68f491ff..e8946269 100644 --- a/frontend/src/composables/services/helpers.ts +++ b/frontend/src/composables/services/helpers.ts @@ -54,8 +54,16 @@ export async function create( } } +/** + * Create an item and display toast message when successful stating the creation has been successful. + * + * @param endpoint + * @param data + * @param ref + * @param fromJson + * @param contentType + */ export async function createToast( - type: string, endpoint: string, data: any, ref: Ref, @@ -67,7 +75,7 @@ export async function createToast( try { await create(endpoint, data, ref, fromJson, contentType) - addSuccessMessage(t('toasts.messages.success'), t('toasts.messages.create', { type: type })); + addSuccessMessage(t('toasts.messages.success'), t('toasts.messages.create')); } catch (e) { throw e }