From 8995047aa5264e330559b100351a1fef4c44adf1 Mon Sep 17 00:00:00 2001 From: andrzej Date: Thu, 3 Oct 2024 10:59:34 +0200 Subject: [PATCH] set base url --- next.config.mjs | 1 + src/middleware.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 5850805..ab1b307 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { output: "standalone", + basePath: "/subman", webpack: (config) => { config.externals = [...config.externals, "bcrypt"]; return config; diff --git a/src/middleware.ts b/src/middleware.ts index 5fd702c..d4c4f72 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -17,7 +17,7 @@ export default async function(request: NextRequest): Promise | und const url = request.nextUrl.clone() - url.pathname = "/login" + url.pathname = "subman/login" url.searchParams.set('from', request.nextUrl.pathname) if (protectedRoutes.some(pattern => matchesWildcard(request.nextUrl.pathname, pattern))) { const token = request.cookies.get('token') @@ -47,7 +47,7 @@ export default async function(request: NextRequest): Promise | und //TODO - TEST THIS BECAUSE IT PROBABLY DOESN'T WORK //redirect from login if already logged in let redirectToApp = false - if (request.nextUrl.pathname === "/login") { + if (request.nextUrl.pathname === "subman/login") { const token = request.cookies.get("token") if (token) { try {