From a2eadbedb1416079fe84d8e219b26f693ffd2144 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Mon, 11 Sep 2023 09:10:44 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(api.tsx):=20add=20conditiona?= =?UTF-8?q?l=20check=20before=20calling=20login=20function=20to=20prevent?= =?UTF-8?q?=20errors=20when=20response=20data=20is=20missing=20access=5Fto?= =?UTF-8?q?ken=20or=20refresh=5Ftoken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/controllers/API/api.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/controllers/API/api.tsx b/src/frontend/src/controllers/API/api.tsx index 4c444ff37..22fef97cd 100644 --- a/src/frontend/src/controllers/API/api.tsx +++ b/src/frontend/src/controllers/API/api.tsx @@ -33,7 +33,10 @@ function ApiInterceptor() { } const res = await renewAccessToken(refreshToken); - login(res?.data?.access_token, res?.data?.refresh_token); + if (res?.data?.access_token && res?.data?.refresh_token) { + login(res?.data?.access_token, res?.data?.refresh_token); + } + try { if (error?.config?.headers) { delete error.config.headers["Authorization"];