From 472e6e07b5ef39d7cd6c847f71462dbbc4fc42db Mon Sep 17 00:00:00 2001 From: Bob Bobs Date: Wed, 28 Feb 2024 15:11:32 -0700 Subject: [PATCH] fix: only delete session if error is Unauthorized --- src/controllers/client/ClientController.tsx | 2 +- src/controllers/client/jsx/error.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controllers/client/ClientController.tsx b/src/controllers/client/ClientController.tsx index 72646f54..5271df73 100644 --- a/src/controllers/client/ClientController.tsx +++ b/src/controllers/client/ClientController.tsx @@ -159,7 +159,7 @@ class ClientController { }) .catch((err) => { const error = takeError(err); - if (error === "Forbidden" || error === "Unauthorized") { + if (error === "Unauthorized") { this.sessions.delete(user_id); this.current = null; this.pickNextSession(); diff --git a/src/controllers/client/jsx/error.tsx b/src/controllers/client/jsx/error.tsx index c171c55a..144b0fd9 100644 --- a/src/controllers/client/jsx/error.tsx +++ b/src/controllers/client/jsx/error.tsx @@ -10,8 +10,9 @@ export function takeError(error: any): string { case 429: return "TooManyRequests"; case 401: + return "Unauthorized" case 403: - return "Unauthorized"; + return "Forbidden"; default: return "UnknownError"; }