fix: add auth error detection to sync-all client
This commit is contained in:
1 parent
e4b6d5db21
commit
43dacea672
1 file changed
+13
@@ -46,6 +46,19 @@ export function SyncAllClient() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!res.headers.get("content-type")?.includes("text/event-stream")) {
|
||||
let errMsg = "Sync failed";
|
||||
try {
|
||||
const json = await res.json();
|
||||
errMsg = json.error || errMsg;
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
toast.error(errMsg);
|
||||
setSyncing(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const reader = res.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
let buf = "";
|
||||
|
||||
Reference in new issue
Block a user