wip: displaying error in a toast
This commit is contained in:
1 parent
a7bec01d7b
commit
195cfd4f84
2 files changed
+20
No files matched your search
@@ -191,6 +191,15 @@
|
||||
})
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const error = await res.json();
|
||||
console.log(error);
|
||||
if ('detail' in error) {
|
||||
toast.error(error.detail);
|
||||
} else {
|
||||
toast.error(error.error);
|
||||
}
|
||||
} else {
|
||||
const reader = res.body
|
||||
.pipeThrough(new TextDecoderStream())
|
||||
.pipeThrough(splitStream('\n'))
|
||||
@@ -266,6 +275,7 @@
|
||||
history: history
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
stopResponseFlag = false;
|
||||
await tick();
|
||||
|
||||
@@ -218,6 +218,15 @@
|
||||
})
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const error = await res.json();
|
||||
console.log(error);
|
||||
if ('detail' in error) {
|
||||
toast.error(error.detail);
|
||||
} else {
|
||||
toast.error(error.error);
|
||||
}
|
||||
} else {
|
||||
const reader = res.body
|
||||
.pipeThrough(new TextDecoderStream())
|
||||
.pipeThrough(splitStream('\n'))
|
||||
@@ -293,6 +302,7 @@
|
||||
history: history
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
stopResponseFlag = false;
|
||||
await tick();
|
||||
|
||||
Reference in new issue
Block a user