Browse Source

Removed unnecessary auth redirect logic

master
Archie 1 week ago
parent
commit
60d087a938
1 changed files with 1 additions and 5 deletions
  1. +1
    -5
      src/pages/_app.js

+ 1
- 5
src/pages/_app.js View File

@ -32,7 +32,6 @@ app.getInitialProps = async (appContext) => {
const excludedPaths = ["/_error"];
const redirectIfLoggedInPaths = ["/login", "/register"];
const allowGuestPaths = [];
// Don't do authentication for excluded paths
if (excludedPaths.includes(ctx.pathname)) return props;
@ -50,10 +49,7 @@ app.getInitialProps = async (appContext) => {
return { ...props, user: { ...user, sessionToken } };
} catch (err) {
if (
!redirectIfLoggedInPaths.includes(ctx.pathname) &&
!allowGuestPaths.includes(ctx.pathname)
)
if (!redirectIfLoggedInPaths.includes(ctx.pathname))
redirect(`/login?next=${ctx.asPath}`);
return props;

Loading…
Cancel
Save