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 {
|
||||
subscribe,
|
||||
addErrorMessage: (e: string|Error): void => {
|
||||
update((messages) => {
|
||||
update((messages: string[]) => {
|
||||
let message: string;
|
||||
if (e instanceof Error) {
|
||||
message = e.message;
|
||||
} else {
|
||||
message = e;
|
||||
}
|
||||
|
||||
if (!messages.includes(message)) {
|
||||
messages.push(message);
|
||||
}
|
||||
|
||||
return messages;
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user