Skip to content

Commit

Permalink
fix: login redirect missing route (#8990)
Browse files Browse the repository at this point in the history
Closes #8920 - login form does not redirect after form submit.

In `handleAuthRedirect` the route parameter was unintentionally getting
overwritten.
  • Loading branch information
JessChowdhury authored Nov 8, 2024
1 parent d20445b commit 010ac2a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/next/src/utilities/initPage/handleAuthRedirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export const handleAuthRedirect = ({ config, route, searchParams, user }: Args):
delete searchParams.redirect
}

const redirectRoute = encodeURIComponent(
route + Object.keys(searchParams ?? {}).length
const redirectRoute =
(route !== adminRoute ? route : '') +
(Object.keys(searchParams ?? {}).length > 0
? `${qs.stringify(searchParams, { addQueryPrefix: true })}`
: undefined,
)
: '')

const redirectTo = formatAdminURL({
adminRoute,
Expand Down

0 comments on commit 010ac2a

Please sign in to comment.