From 1a7676185ac5b0d5f2ceb74c086060d2988d5939 Mon Sep 17 00:00:00 2001 From: jhsong233 Date: Fri, 10 Oct 2025 11:49:03 +0800 Subject: [PATCH 1/2] fix: mark Home component as async to support await The example used `await getLogtoContext()` inside a normal function, which caused a TypeScript error (TS1308). 'await' expressions are only allowed within async functions and at the top levels of modules. Marking the Home component as async resolves the error. --- docs/quick-starts/framework/next-app-router/_integration.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/quick-starts/framework/next-app-router/_integration.mdx b/docs/quick-starts/framework/next-app-router/_integration.mdx index 93abe2d162f..8cf17fc324d 100644 --- a/docs/quick-starts/framework/next-app-router/_integration.mdx +++ b/docs/quick-starts/framework/next-app-router/_integration.mdx @@ -121,7 +121,7 @@ import SignIn from './sign-in'; import SignOut from './sign-out'; import { logtoConfig } from './logto'; -const Home = () => { +export default async function Home() { const { isAuthenticated, claims } = await getLogtoContext(logtoConfig); return ( @@ -151,8 +151,6 @@ const Home = () => { ); }; - -export default Home; ``` From d063f4c25363098b58feb56e61de0043ed0e6ddf Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Thu, 23 Oct 2025 17:14:11 +0800 Subject: [PATCH 2/2] fix: lint error --- docs/quick-starts/framework/next-app-router/_integration.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quick-starts/framework/next-app-router/_integration.mdx b/docs/quick-starts/framework/next-app-router/_integration.mdx index 8cf17fc324d..bb0e43fb8c8 100644 --- a/docs/quick-starts/framework/next-app-router/_integration.mdx +++ b/docs/quick-starts/framework/next-app-router/_integration.mdx @@ -150,7 +150,7 @@ export default async function Home() { )} ); -}; +} ```