Skip to content
Snippets Groups Projects
Commit f91f90fe authored by Julian's avatar Julian
Browse files

Create generic toasting methods

parent cbba4d72
No related branches found
No related tags found
1 merge request!1304Refactor calendar overview in more different components
......@@ -317,6 +317,10 @@
"saved": "Alle Änderungen sind gespeichert.",
"updating": "Änderungen werden synchronisiert."
},
"generic_messages": {
"error": "Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.",
"success": "Der Vorgang wurde erfolgreich beendet."
},
"weekdays": {
"A_0": "Montag",
"A_1": "Dienstag",
......
......@@ -283,6 +283,10 @@
"object_delete_success": "The object was deleted successfully.",
"objects_delete_success": "The objects were deleted successfully."
},
"generic_messages": {
"error": "An error occurred. Please try again.",
"success": "The operation has been finished successfully."
},
"rooms": {
"menu_title": "Rooms",
"title_plural": "Rooms",
......
......@@ -18,6 +18,34 @@ const aleksisMixin = {
handler: handler,
});
},
$toast(messageKey, state, timeout) {
this.$root.snackbarItems.push({
id: crypto.randomUUID(),
timeout: timeout || 5000,
messageKey: this.$t(messageKey),
color: state || "error",
});
},
$toastError(messageKey, timeout) {
this.$toast(
messageKey || "generic_messages.error",
"error",
timeout,
);
},
$toastSuccess(messageKey, timeout) {
this.$toast(
messageKey || "generic_messages.success",
"success",
timeout,
)
},
$toastInfo(messageKey, timeout) {
this.$toast(messageKey, "info", timeout);
},
$toastWarning(messageKey, timeout) {
this.$toast(messageKey, "warning", timeout);
}
},
mounted() {
this.$emit("mounted");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment