update the domains

This commit is contained in:
root
2026-05-16 16:51:59 -04:00
parent 4408f7cc8f
commit 7e4fb6d62a
9 changed files with 50 additions and 44 deletions
+7 -6
View File
@@ -1,17 +1,18 @@
import { resolveBrowserAppUrl } from '@/lib/appUrls'
function toAppOrigin(url: string): string {
function toAppBase(url: string): string {
try {
return new URL(url).origin
const u = new URL(url)
return (u.origin + u.pathname).replace(/\/$/, '')
} catch {
return url.replace(/\/$/, '')
}
}
export const marketplaceUrl = toAppOrigin(
resolveBrowserAppUrl(process.env.NEXT_PUBLIC_MARKETPLACE_URL ?? 'http://localhost:3000'),
export const marketplaceUrl = toAppBase(
resolveBrowserAppUrl(process.env.NEXT_PUBLIC_MARKETPLACE_URL ?? 'http://localhost:3000/marketplace'),
)
export const adminUrl = toAppOrigin(
resolveBrowserAppUrl(process.env.NEXT_PUBLIC_ADMIN_URL ?? 'http://localhost:3002'),
export const adminUrl = toAppBase(
resolveBrowserAppUrl(process.env.NEXT_PUBLIC_ADMIN_URL ?? 'http://localhost:3002/admin'),
)
+2 -1
View File
@@ -11,7 +11,8 @@ function localJwtMiddleware(req: NextRequest): NextResponse {
// Check for employee_token cookie (set on login) OR allow if coming from sign-in
const token = req.cookies.get('employee_token')?.value
if (!token) {
const signInUrl = new URL('/sign-in', req.url)
const signInUrl = req.nextUrl.clone()
signInUrl.pathname = '/sign-in'
signInUrl.searchParams.set('redirect', req.nextUrl.pathname)
return NextResponse.redirect(signInUrl)
}