Prevents error message from being displayed twice in the same dialog
This commit is contained in:
parent
9f09dc9df2
commit
bacd260547
@ -9,14 +9,18 @@ function createErrorStore() {
|
|||||||
return {
|
return {
|
||||||
subscribe,
|
subscribe,
|
||||||
addErrorMessage: (e: string|Error): void => {
|
addErrorMessage: (e: string|Error): void => {
|
||||||
update((messages) => {
|
update((messages: string[]) => {
|
||||||
let message: string;
|
let message: string;
|
||||||
if (e instanceof Error) {
|
if (e instanceof Error) {
|
||||||
message = e.message;
|
message = e.message;
|
||||||
} else {
|
} else {
|
||||||
message = e;
|
message = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!messages.includes(message)) {
|
||||||
messages.push(message);
|
messages.push(message);
|
||||||
|
}
|
||||||
|
|
||||||
return messages;
|
return messages;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user