@@ -136,9 +136,11 @@ export type WithPageAuthRequiredAppRouterOptions = {
136
136
* // app/protected-page/page.js
137
137
* import { withPageAuthRequired } from '@auth0/nextjs-auth0';
138
138
*
139
- * export default function withPageAuthRequired(ProtectedPage() {
139
+ * const ProtectedPage = withPageAuthRequired(async function ProtectedPage() {
140
140
* return <div>Protected content</div>;
141
141
* }, { returnTo: '/protected-page' });
142
+ *
143
+ * export default ProtectedPage;
142
144
* ```
143
145
*
144
146
* If the user visits `/protected-page` without a valid session, it will redirect the user to the
@@ -153,15 +155,20 @@ export type WithPageAuthRequiredAppRouterOptions = {
153
155
*
154
156
* ```js
155
157
* // app/protected-page/[slug]/page.js
156
- * import { withPageAuthRequired } from '@auth0/nextjs-auth0';
157
- *
158
- * export default function withPageAuthRequired(ProtectedPage() {
159
- * return <div>Protected content</div>;
158
+ * import { AppRouterPageRouteOpts, withPageAuthRequired } from '@auth0/nextjs-auth0';
159
+ *
160
+ * const ProtectedPage = withPageAuthRequired(async function ProtectedPage({
161
+ * params, searchParams
162
+ * }: AppRouterPageRouteOpts) {
163
+ * const slug = params?.slug as string;
164
+ * return <div>Protected content for {slug}</div>;
160
165
* }, {
161
166
* returnTo({ params }) {
162
- * return `/protected-page/${params.slug}`
167
+ * return `/protected-page/${params? .slug}`;
163
168
* }
164
169
* });
170
+ *
171
+ * export default ProtectedPage;
165
172
* ```
166
173
*
167
174
* @category Server
0 commit comments