Skip to content

Commit

Permalink
adds correct export
Browse files Browse the repository at this point in the history
  • Loading branch information
alist authored May 20, 2024
1 parent e35151d commit 5ed8ee3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/helpers/with-page-auth-required.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ export type WithPageAuthRequiredAppRouterOptions = {
* // app/protected-page/page.js
* import { withPageAuthRequired } from '@auth0/nextjs-auth0';
*
* export default withPageAuthRequired(async function ProtectedPage() {
* const ProtectedPage = withPageAuthRequired(async function ProtectedPage() {
* return <div>Protected content</div>;
* }, { returnTo: '/protected-page' });
*
* export default ProtectedPage;
* ```
*
* If the user visits `/protected-page` without a valid session, it will redirect the user to the
Expand All @@ -154,16 +156,19 @@ export type WithPageAuthRequiredAppRouterOptions = {
* ```js
* // app/protected-page/[slug]/page.js
* import { AppRouterPageRouteOpts, withPageAuthRequired } from '@auth0/nextjs-auth0';
*
* export default withPageAuthRequired(async function ProtectedPage({
*
* const ProtectedPage = withPageAuthRequired(async function ProtectedPage({
* params, searchParams
* }: AppRouterPageRouteOpts) {
* return <div>Protected content</div>;
* const slug = params?.slug as string;
* return <div>Protected content for {slug}</div>;
* }, {
* returnTo({ params }) {
* return `/protected-page/${params?.slug}`;
* }
* });
*
* export default ProtectedPage;
* ```
*
* @category Server
Expand Down

0 comments on commit 5ed8ee3

Please sign in to comment.