Skip to content

Commit

Permalink
Merge Dev into Staging, April 30, 2024 (#640)
Browse files Browse the repository at this point in the history
* update opentel

* Fix splash page language redirect based on query param (#639)

---------

Co-authored-by: shewood <[email protected]>
Co-authored-by: shewood <[email protected]>
  • Loading branch information
3 people authored Apr 30, 2024
1 parent 842cb77 commit b9b47b8
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 164 deletions.
12 changes: 6 additions & 6 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PUBLIC_FILE = /\.(.*)$/

export async function middleware(req: NextRequest) {
const { nextUrl, url } = req
const { locale, pathname } = nextUrl
const { locale, pathname, searchParams } = nextUrl
const logger = getLogger('middleware')

logger.trace(`Incoming request for [${url}]`)
Expand All @@ -20,11 +20,11 @@ export async function middleware(req: NextRequest) {
}

//Redirect from splash page if Lang parameter is supplied when redirecting from MSCA
if (pathname === '/?Lang=fra') {
return NextResponse.redirect(new URL(`/fr/mon-tableau-de-bord`, url))
}
if (pathname === '/?Lang=eng') {
return NextResponse.redirect(new URL(`/en/my-dashboard`, url))
switch (searchParams.get('Lang')) {
case 'fra':
return NextResponse.redirect(new URL(`/fr/mon-tableau-de-bord`, url))
case 'eng':
return NextResponse.redirect(new URL(`/en/my-dashboard`, url))
}

//Redirect rule that makes English appear as the default language instead of und
Expand Down
Loading

0 comments on commit b9b47b8

Please sign in to comment.