Skip to content

Commit 010ac2a

Browse files
authored
fix: login redirect missing route (#8990)
Closes #8920 - login form does not redirect after form submit. In `handleAuthRedirect` the route parameter was unintentionally getting overwritten.
1 parent d20445b commit 010ac2a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/next/src/utilities/initPage/handleAuthRedirect.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export const handleAuthRedirect = ({ config, route, searchParams, user }: Args):
2121
delete searchParams.redirect
2222
}
2323

24-
const redirectRoute = encodeURIComponent(
25-
route + Object.keys(searchParams ?? {}).length
24+
const redirectRoute =
25+
(route !== adminRoute ? route : '') +
26+
(Object.keys(searchParams ?? {}).length > 0
2627
? `${qs.stringify(searchParams, { addQueryPrefix: true })}`
27-
: undefined,
28-
)
28+
: '')
2929

3030
const redirectTo = formatAdminURL({
3131
adminRoute,

0 commit comments

Comments
 (0)