52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
|
|
export function NEW_MESSAGE_DIALOG (state, messageObject) {
|
|
// console.log("NEW_MESSAGE_DIALOG");
|
|
// console.log(messageObject);
|
|
if (messageObject == null) {
|
|
state.dialog.show = true;
|
|
return;
|
|
}
|
|
// console.log(messageObject);
|
|
|
|
if (messageObject.hasOwnProperty('color')) {
|
|
switch (messageObject.color) {
|
|
case "red": {
|
|
let color = "red-9";
|
|
state.dialog.colorBackground = "bg-"+color+" text-white";
|
|
state.dialog.colorButton = color;
|
|
break;
|
|
}
|
|
case "amber": {
|
|
let color = "amber";
|
|
state.dialog.colorBackground = "bg-"+color+" text-white";
|
|
state.dialog.colorButton = color;
|
|
break;
|
|
}
|
|
case "blue": {
|
|
let color = "primary";
|
|
state.dialog.colorBackground = "bg-"+color+" text-white";
|
|
state.dialog.colorButton = color;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (messageObject.hasOwnProperty('title')) {
|
|
state.dialog.title = messageObject.title;
|
|
}
|
|
|
|
if (messageObject.hasOwnProperty('message')) {
|
|
state.dialog.message = messageObject.message;
|
|
}
|
|
|
|
state.dialog.show = true;
|
|
}
|
|
export function RESET_MESSAGE_DIALOG (state) {
|
|
// console.log("RESET_MESSAGE_DIALOG");
|
|
state.dialog.colorBackground = "bg-red-9 text-white";
|
|
state.dialog.colorButton = "red-9";
|
|
state.dialog.message = "Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es noch einmal.";
|
|
state.dialog.title = "Fehler";
|
|
state.dialog.show = false;
|
|
}
|