Skip to content

Commit

Permalink
chore: make general for now #407
Browse files Browse the repository at this point in the history
  • Loading branch information
bsilkyn committed May 18, 2024
1 parent 4cc1467 commit 7b28362
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/src/assets/lang/app/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}'.",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/assets/lang/app/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}'.",
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/composables/services/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,16 @@ export async function create<T>(
}
}

/**
* 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<T>(
type: string,
endpoint: string,
data: any,
ref: Ref<T | null>,
Expand All @@ -67,7 +75,7 @@ export async function createToast<T>(

try {
await create<T>(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
}
Expand Down

0 comments on commit 7b28362

Please sign in to comment.