diff --git a/src/app/html/layout.tsx b/src/app/html/layout.tsx index d771efa..7850a66 100644 --- a/src/app/html/layout.tsx +++ b/src/app/html/layout.tsx @@ -1,3 +1,4 @@ +import { awaitTo } from '@stoqey/client-graphql'; import { cookies, headers } from 'next/headers'; import React from 'react'; @@ -8,6 +9,7 @@ import { getMyWallets, getRates } from '@/lib/hooksServer/wallet'; import { HtmlPageWrapper } from './html.wrapper'; +const publicRoutes = ['/html/login', '/html/signup', '/html/forgot-password']; export default async function RootLayout({ children, }: { @@ -22,15 +24,8 @@ export default async function RootLayout({ let user; let openSideBar; let theme; - // endgamex, - // endgamei; - // endgamex = cookieStore.get("endgamex")?.value || ""; - // endgamei = cookieStore.get("endgamei")?.value || ""; - // const endgame = await validateEndgameSession(endgamex, endgamei); - // if (endgame) { - // return sendToIndex(); - // } + const [, currentUrl] = await awaitTo(Promise.resolve(new URL(fullUrl))); theme = cookieStore.get('theme')?.value; openSideBar = cookieStore.get('openSidebar')?.value === 'true'; @@ -42,7 +37,11 @@ export default async function RootLayout({ if (user) { vendor = await getVendor(); wallets = await getMyWallets(walletscurrencies); - } else if (!fullUrl.includes('login') && !fullUrl.includes('signup')) { + } else if ( + !publicRoutes.some((route) => + (currentUrl?.pathname || '').startsWith(route), + ) + ) { return ; } diff --git a/src/containers/SignIn/ForgotPasswordForm.html.tsx b/src/containers/SignIn/ForgotPasswordForm.html.tsx index 520ff30..f5fe5e7 100644 --- a/src/containers/SignIn/ForgotPasswordForm.html.tsx +++ b/src/containers/SignIn/ForgotPasswordForm.html.tsx @@ -55,9 +55,6 @@ export function ForgotPasswordFormHtml(state: ForgotPasswordFormHtmlProps) { const { success = false, message = '', - username, - newPassword, - newPasswordRepeat, confirmCode, codeId, verified: isVerified, diff --git a/src/lib/apollo-wrapper.server.tsx b/src/lib/apollo-wrapper.server.tsx index c9a193d..7a3079e 100644 --- a/src/lib/apollo-wrapper.server.tsx +++ b/src/lib/apollo-wrapper.server.tsx @@ -107,7 +107,7 @@ function createApolloClient() { // // log.error('Error when refreshing TOKEN', message); // } if (includes(message.toLocaleLowerCase(), 'not authenticated')) { - console.log('APPEVENTS.LOGOUT not authenticated', message); + // console.log('APPEVENTS.LOGOUT not authenticated server', message); // Ask user to login again events.emit(APPEVENTS.LOGOUT, APPEVENTS.LOGOUT); // emit logout }