Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add path to redirectToHome #219

Merged
merged 1 commit into from
Jul 25, 2024
Merged

Conversation

ignaciano3
Copy link
Contributor

Hello, I really liked this package! I would like to contribute my grain of sand!

I found that normally you would like to set the home path (aka "/") to be public. The problem is that, following the example provided in the starter kit, using redirectToHome would let to infinite redirects. Also, sometimes 'Home' would be a path like /dashboard.

So we were changing from this:

 handleValidToken: async ({token, decodedToken}, headers) => {
      if (PUBLIC_PATHS.includes(request.nextUrl.pathname)) {
        return redirectToHome(request);
      }
      // ....
}

to this:

 handleValidToken: async ({token, decodedToken}, headers) => {
      if (PUBLIC_PATHS.includes(request.nextUrl.pathname)) {
        return redirectToHome(request, { path: "/dashboard" });
      }
      // ....
}

@awinogrodzki awinogrodzki changed the base branch from main to canary July 25, 2024 10:18
@awinogrodzki
Copy link
Owner

Hey @ignaciano3!

Thank you for this pull request – I really appreciate it.

I changed the base branch to canary to introduce the change in the latest canary version

@awinogrodzki awinogrodzki merged commit 0b65b4c into awinogrodzki:canary Jul 25, 2024
2 of 4 checks passed
awinogrodzki added a commit that referenced this pull request Jul 25, 2024
feat: add path to redirectToHome
@awinogrodzki
Copy link
Owner

Hello again @ignaciano3!

Your changes are now available in v1.7.0-canary.2. It will be released in v1.7.0 soon

@ignaciano3
Copy link
Contributor Author

Excellent!
I am already using the canary version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants