fix(web): auth bad login flash (#820)

[DEV-820] bugfix: since it's 401 we should reject the promise that way onError actually works. I think this was causing login to succeed  for like a second then goes back to login but with this we reject it early shouldn't pass the login screen.

Co-authored-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh 2023-04-10 23:47:32 +10:00 committed by GitHub
parent 2534186b5f
commit d48e94ff33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,7 +33,7 @@ export async function HttpClient<T>(
AuthContext.reset(); AuthContext.reset();
// Show an error toast to notify the user what occurred // Show an error toast to notify the user what occurred
return Promise.resolve(response); return Promise.reject(new Error("Unauthorized"));
} }
return Promise.reject(new Error(await response.text())); return Promise.reject(new Error(await response.text()));