Skip to content

Commit

Permalink
Update docs (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasballinger authored Nov 29, 2024
1 parent 0e07935 commit aeafbf2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions docs/pages/api_reference/nextjs/server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Convex backend from Server Components, Server Actions and Route Handlers.

<h3 className="nx-font-semibold nx-tracking-tight nx-text-slate-900 dark:nx-text-slate-100 nx-mt-8 nx-text-2xl">Returns</h3>

`undefined` \| `string`
`Promise<undefined | string>`

The token if the the client is authenticated, otherwise `undefined`.

Expand All @@ -170,7 +170,7 @@ since they won't stop nested pages from rendering.

<h3 className="nx-font-semibold nx-tracking-tight nx-text-slate-900 dark:nx-text-slate-100 nx-mt-8 nx-text-2xl">Returns</h3>

`boolean`
`Promise<boolean>`

<h3 className="nx-font-semibold nx-tracking-tight nx-text-slate-900 dark:nx-text-slate-100 nx-mt-8 nx-text-2xl">Defined in</h3>

Expand All @@ -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");
}
};
Expand All @@ -202,14 +202,14 @@ export function convexAuthNextjsMiddleware(handler, options) {

<h5 className="nx-font-semibold nx-tracking-tight nx-text-slate-900 dark:nx-text-slate-100 nx-mt-8 nx-text-lg">Returns</h5>

`string` \| `undefined`
`Promise<string | undefined>`

#### isAuthenticated()


<h5 className="nx-font-semibold nx-tracking-tight nx-text-slate-900 dark:nx-text-slate-100 nx-mt-8 nx-text-lg">Returns</h5>

`boolean`
`Promise<boolean>`

<h3 className="nx-font-semibold nx-tracking-tight nx-text-slate-900 dark:nx-text-slate-100 nx-mt-8 nx-text-2xl">Defined in</h3>

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/authz/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit aeafbf2

Please sign in to comment.