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

Fix and Improve withPageAuthRequired Documentation #1750

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alist
Copy link

@alist alist commented May 20, 2024

with-page-auth-required.ts was incompatible with next14 app router.

📋 Changes

Description:
This PR fixes a typo and updates the code examples for withPageAuthRequired in the documentation. The changes ensure compatibility with Next.js 14 and TypeScript by using the AppRouterPageRouteOpts type for parameters. Additionally, the function keyword is moved inside the withPageAuthRequired call for clarity and better readability.

Changes:

  1. Fixed a typo in the withPageAuthRequired code example. By moving the function keyword inside the withPageAuthRequired call.
  2. Updated code example to use AppRouterPageRouteOpts for better TypeScript support.
  3. Added type assertions for params to prevent type errors.
  4. Have to do separate function declaration and export

Reference:
Link to updated documentation page

📎 References

🎯 Testing

@alist
Copy link
Author

alist commented May 20, 2024

Sorry wait my fix doesn't work, it's getting 404 despite now compiling.

@alist
Copy link
Author

alist commented May 20, 2024

Ok this is verified to work now

@branlok
Copy link

branlok commented Sep 3, 2024

This was helpful, thanks.

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