Skip to content

Commit

Permalink
Merge pull request #168 from seatsurfing/issue-166
Browse files Browse the repository at this point in the history
Fix for #166
  • Loading branch information
virtualzone committed Jul 28, 2023
2 parents 7cc4748 + dddd617 commit 3da3db9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion admin-ui/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ export async function middleware(req: NextRequest) {

if (req.nextUrl.locale === 'default') {
const locale = req.cookies.get('NEXT_LOCALE')?.value || 'en';
// https://github.com/seatsurfing/backend/issues/166
const hostname = process.env.FRONTEND_URL ? process.env.FRONTEND_URL : req.url;

return NextResponse.redirect(
new URL(
`/admin/${locale}${req.nextUrl.pathname}${req.nextUrl.search}`,
"http://localhost:3000", // https://github.com/seatsurfing/backend/issues/166
hostname,
),
);
}
Expand Down
4 changes: 3 additions & 1 deletion booking-ui/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ export async function middleware(req: NextRequest) {

if (req.nextUrl.locale === 'default') {
const locale = req.cookies.get('NEXT_LOCALE')?.value || 'en';
// https://github.com/seatsurfing/backend/issues/166
const hostname = process.env.FRONTEND_URL ? process.env.FRONTEND_URL : req.url;

return NextResponse.redirect(
new URL(
`/ui/${locale}${req.nextUrl.pathname}${req.nextUrl.search}`,
"http://localhost:3001", // https://github.com/seatsurfing/backend/issues/166
hostname,
),
);
}
Expand Down

0 comments on commit 3da3db9

Please sign in to comment.