From 991b2b23518b34da3f8acb13453bfe073ce320c8 Mon Sep 17 00:00:00 2001 From: Tomeshwari-02 <179694969+Tomeshwari-02@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:15:04 +0530 Subject: [PATCH] Call registered reauth handler --- src/config/api/interceptors.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/config/api/interceptors.js b/src/config/api/interceptors.js index 8335d59dc..0aaccc1df 100644 --- a/src/config/api/interceptors.js +++ b/src/config/api/interceptors.js @@ -59,8 +59,15 @@ export const createResponseInterceptor = (API) => { const reject = async (error) => { const config = error.config || {}; const status = error?.response?.status; + const errorCode = error?.response?.data?.code; - if (status === 401 && onUnauthorized) onUnauthorized(); + if (status === 401) { + if (errorCode === "REQUIRES_REAUTH" && _onRequiresReauth) { + _onRequiresReauth(); + } else if (onUnauthorized) { + onUnauthorized(); + } + } const retryCount = config._retryCount || 0; const isNonMutating = RETRYABLE_METHODS.has(config.method?.toUpperCase() ?? "");