Skip to content

Commit

Permalink
fix base url
Browse files Browse the repository at this point in the history
  • Loading branch information
csuvajit committed Nov 9, 2024
1 parent b61c0c9 commit 3a6fd27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
15 changes: 9 additions & 6 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ const validateAuth = async () => {
const isAuthenticatedPath = authenticatedPathRegex.test(pathname);
if (!isAuthenticatedPath) return null;

const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/status`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`
const res = await fetch(
`${process.env.NEXT_PUBLIC_BACKEND_URL}/auth/status`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`
}
}
});
);

if (res.status === 401 || res.status === 403) {
return redirect('/');
Expand Down
8 changes: 2 additions & 6 deletions lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
export const authCookieKey = 'x-token';

export const authenticatedPaths = ['/embeds', '/reminders', '/rosters'];
export const authenticatedPaths = ['/embeds', '/reminders'];

export const authenticatedPathsRegex = [
/^\/embeds/,
/^\/reminders/,
/^\/rosters\/?/
];
export const authenticatedPathsRegex = [/^\/embeds/, /^\/reminders/];

export const authenticatedPathRegex = new RegExp(
authenticatedPathsRegex.map((route) => route.source).join('|')
Expand Down

0 comments on commit 3a6fd27

Please sign in to comment.