Skip to content

Commit

Permalink
with-page-auth-required.ts is incompatible with next14 app router
Browse files Browse the repository at this point in the history
  • Loading branch information
alist authored May 20, 2024
1 parent 951a248 commit e35151d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/helpers/with-page-auth-required.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export type WithPageAuthRequiredAppRouterOptions = {
* // app/protected-page/page.js
* import { withPageAuthRequired } from '@auth0/nextjs-auth0';
*
* export default function withPageAuthRequired(ProtectedPage() {
* export default withPageAuthRequired(async function ProtectedPage() {
* return <div>Protected content</div>;
* }, { returnTo: '/protected-page' });
* ```
Expand All @@ -153,13 +153,15 @@ export type WithPageAuthRequiredAppRouterOptions = {
*
* ```js
* // app/protected-page/[slug]/page.js
* import { withPageAuthRequired } from '@auth0/nextjs-auth0';
* import { AppRouterPageRouteOpts, withPageAuthRequired } from '@auth0/nextjs-auth0';
*
* export default function withPageAuthRequired(ProtectedPage() {
* export default withPageAuthRequired(async function ProtectedPage({
* params, searchParams
* }: AppRouterPageRouteOpts) {
* return <div>Protected content</div>;
* }, {
* returnTo({ params }) {
* return `/protected-page/${params.slug}`
* return `/protected-page/${params?.slug}`;
* }
* });
* ```
Expand Down

0 comments on commit e35151d

Please sign in to comment.