From 8154b05a950b0a8db0796031355326d5f0ec68ad Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 10 Nov 2023 11:43:40 +0530 Subject: [PATCH] fix: handle if extra prop is missing in response --- packages/nc-gui/middleware/auth.global.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/middleware/auth.global.ts b/packages/nc-gui/middleware/auth.global.ts index 3ab3d1cf50..dad1a3b92d 100644 --- a/packages/nc-gui/middleware/auth.global.ts +++ b/packages/nc-gui/middleware/auth.global.ts @@ -137,7 +137,7 @@ async function tryGoogleAuth(api: Api, signIn: Actions['signIn']) { data: { token, extra }, } = await api.instance.post(`/auth/${authProvider}/genTokenByCode${window.location.search}`) - extraProps = extra + extraProps = extra || {} signIn(token) } catch (e: any) { @@ -148,7 +148,7 @@ async function tryGoogleAuth(api: Api, signIn: Actions['signIn']) { window.history.pushState( 'object', document.title, - `${extraProps.continueAfterSignIn ? `${newURL}#/?continueAfterSignIn=${extraProps.continueAfterSignIn}` : newURL}`, + `${extraProps?.continueAfterSignIn ? `${newURL}#/?continueAfterSignIn=${extraProps.continueAfterSignIn}` : newURL}`, ) window.location.reload() }