From a901dc9cb819d070860529c3115b718d84b38a43 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Mon, 6 Dec 2021 12:47:32 +0500 Subject: [PATCH] fix: do not try to refresh token on session expiry --- .../dialogs/sessionexpireddialog.js | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/apps/web/src/components/dialogs/sessionexpireddialog.js b/apps/web/src/components/dialogs/sessionexpireddialog.js index 5a2ed9e23..7de7e3ce3 100644 --- a/apps/web/src/components/dialogs/sessionexpireddialog.js +++ b/apps/web/src/components/dialogs/sessionexpireddialog.js @@ -20,7 +20,7 @@ function maskEmail(email) { } function SessionExpiredDialog(props) { - const [isLoading, setIsLoading] = useState(false); + const [isLoading, setIsLoading] = useState(true); const { onClose, email } = props; const [error, setError] = useState(); @@ -30,18 +30,7 @@ function SessionExpiredDialog(props) { useEffect(() => { if (!isAppLoaded) return; - - (async () => { - setIsLoading(true); - try { - const token = await db.user.tokenManager.getToken(); - if (token) onClose(true); - } catch (e) { - setError(`Could not refresh access_token. Error: ${e.message}`); - } finally { - setIsLoading(false); - } - })(); + setIsLoading(false); }, [onClose, isAppLoaded]); return ( @@ -75,7 +64,7 @@ function SessionExpiredDialog(props) { form: "loginForm", type: "submit", }, - text: "Sign in", + text: "Refresh session", loading: isLoggingIn || isLoading, disabled: isLoggingIn || isLoading, }} @@ -104,10 +93,10 @@ function SessionExpiredDialog(props) { flexDirection="column" >