From 030eed78045fedd788cb9e925469329ca2a67982 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Thu, 11 Jan 2024 10:02:13 -0300 Subject: [PATCH] fix(authContext.tsx): add check for isAuthenticated before attempting to logout to prevent unnecessary logout calls --- src/frontend/src/contexts/authContext.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/frontend/src/contexts/authContext.tsx b/src/frontend/src/contexts/authContext.tsx index be2f279c9..18145b0af 100644 --- a/src/frontend/src/contexts/authContext.tsx +++ b/src/frontend/src/contexts/authContext.tsx @@ -104,6 +104,9 @@ export function AuthProvider({ children }): React.ReactElement { } async function logout() { + if (!isAuthenticated) { + return; + } try { await requestLogout(); cookies.remove("apikey_tkn_lflw", { path: "/" });