From d48e94ff336b2135b11b97d5c6de54b81cdbb044 Mon Sep 17 00:00:00 2001 From: KaiserBh <41852205+KaiserBh@users.noreply.github.com> Date: Mon, 10 Apr 2023 23:47:32 +1000 Subject: [PATCH] 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 --- web/src/api/APIClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/api/APIClient.ts b/web/src/api/APIClient.ts index 92d7c462..11cc24a 100644 --- a/web/src/api/APIClient.ts +++ b/web/src/api/APIClient.ts @@ -33,7 +33,7 @@ export async function HttpClient( AuthContext.reset(); // 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()));