set base url
Gitea/subman-nextjs/pipeline/head This commit looks good Details

This commit is contained in:
andrzej 2024-10-03 10:59:34 +02:00
parent 0bade3c1c9
commit 8995047aa5
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
basePath: "/subman",
webpack: (config) => {
config.externals = [...config.externals, "bcrypt"];
return config;

View File

@ -17,7 +17,7 @@ export default async function(request: NextRequest): Promise<NextResponse> | 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<NextResponse> | 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 {