Skip to content

Commit

Permalink
public routes
Browse files Browse the repository at this point in the history
  • Loading branch information
ceddybi committed Mar 24, 2024
1 parent d7bbd3c commit 92e4f8d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
17 changes: 8 additions & 9 deletions src/app/html/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { awaitTo } from '@stoqey/client-graphql';
import { cookies, headers } from 'next/headers';
import React from 'react';

Expand All @@ -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,
}: {
Expand All @@ -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';
Expand All @@ -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 <meta httpEquiv="refresh" content="0; url=/html/login" />;
}

Expand Down
3 changes: 0 additions & 3 deletions src/containers/SignIn/ForgotPasswordForm.html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ export function ForgotPasswordFormHtml(state: ForgotPasswordFormHtmlProps) {
const {
success = false,
message = '',
username,
newPassword,
newPasswordRepeat,
confirmCode,
codeId,
verified: isVerified,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/apollo-wrapper.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 92e4f8d

Please sign in to comment.