From b6b1d114932c0fcc2fcd8e5784f0bc326bf7e224 Mon Sep 17 00:00:00 2001 From: tim kryha Date: Fri, 10 Nov 2023 12:12:05 +0100 Subject: [PATCH] fix window being undefined throwing error on nextjs server --- apps/Wallet/src/app/login/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Wallet/src/app/login/page.tsx b/apps/Wallet/src/app/login/page.tsx index 478882f..aaa9d7d 100644 --- a/apps/Wallet/src/app/login/page.tsx +++ b/apps/Wallet/src/app/login/page.tsx @@ -17,7 +17,7 @@ export default function Login() { const login = useLogin(); const [isLoggingIn, setIsLoggingIn] = useState(false); const { push } = useRouter(); - const openlogin_store = localStorage.getItem("openlogin_store") || ""; + const openlogin_store = typeof window !== "undefined" ? localStorage.getItem("openlogin_store") : ""; const hasSessionId = openlogin_store ? Boolean(JSON.parse(openlogin_store).sessionId) : false; const handleOnLoginClick = async () => {