From 7425e9494043ae1e14e0e4d30ec5e6e33ed9fa26 Mon Sep 17 00:00:00 2001 From: Tom Ballinger Date: Thu, 28 Nov 2024 18:09:53 -0800 Subject: [PATCH] Update docs --- docs/pages/api_reference/nextjs/server.mdx | 10 +++++----- docs/pages/authz/nextjs.mdx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/pages/api_reference/nextjs/server.mdx b/docs/pages/api_reference/nextjs/server.mdx index 24c4084..8ed8fba 100644 --- a/docs/pages/api_reference/nextjs/server.mdx +++ b/docs/pages/api_reference/nextjs/server.mdx @@ -149,7 +149,7 @@ Convex backend from Server Components, Server Actions and Route Handlers.

Returns

-`undefined` \| `string` +`Promise` The token if the the client is authenticated, otherwise `undefined`. @@ -170,7 +170,7 @@ since they won't stop nested pages from rendering.

Returns

-`boolean` +`Promise`

Defined in

@@ -188,7 +188,7 @@ to get the token and check if the client is authenticated in place of ```ts export function convexAuthNextjsMiddleware(handler, options) { return async (request, event, convexAuth) => { - if (!convexAuth.isAuthenticated()) { + if (!(await convexAuth.isAuthenticated())) { return nextjsMiddlewareRedirect(request, "/login"); } }; @@ -202,14 +202,14 @@ export function convexAuthNextjsMiddleware(handler, options) {
Returns
-`string` \| `undefined` +`Promise` #### isAuthenticated()
Returns
-`boolean` +`Promise`

Defined in

diff --git a/docs/pages/authz/nextjs.mdx b/docs/pages/authz/nextjs.mdx index 3e84a6b..1248683 100644 --- a/docs/pages/authz/nextjs.mdx +++ b/docs/pages/authz/nextjs.mdx @@ -25,7 +25,7 @@ import { const isSignInPage = createRouteMatcher(["/signin"]); const isProtectedRoute = createRouteMatcher(["/product(.*)"]); -export default convexAuthNextjsMiddleware((request, { convexAuth }) => { +export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => { if (isSignInPage(request) && (await convexAuth.isAuthenticated())) { return nextjsMiddlewareRedirect(request, "/product"); }