Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs for Next.js 15 #128

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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