blitz-js / blitz-js/blitz

make next argument optional when using authenticate = { redirectTo: '' }

Open
#3,121 0 comments 0 reactions 0 assignees View on GitHub
kind/feature-change status/ready-to-work-on
Dominant language
TypeScript
Stars
14.1k
Forks
803
PR merge metrics
No merged PRs in 30d

Description

### What do you want and why?

Sometimes when using `Page.authenticate = { redirectTo: Routes.HomePage() }` it's not necessary to keep the current page path in the next argument. One example of this is when logging out. Once the user logs out and we want to redirect to the home page, we don't really care when you came before that. The next argument is valid when trying to go to an authenticated page but you're not logged in. In that case you'd want to remember where you were going before showing the login

### Possible implementation(s)

Maybe just add an extra option to the `authenticate` when using it with redirectTo so then it could be checked here https://github.com/blitz-js/blitz/blob/de874ca20e1e2b03e61013fbc5e64a784d28cc30/nextjs/packages/next/stdlib/blitz-app-root.tsx#L159

### Additional context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.