Skip to content

Commit 1a76761

Browse files
committed
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.
1 parent 179585c commit 1a76761

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

docs/quick-starts/framework/next-app-router/_integration.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ import SignIn from './sign-in';
121121
import SignOut from './sign-out';
122122
import { logtoConfig } from './logto';
123123

124-
const Home = () => {
124+
export default async function Home() {
125125
const { isAuthenticated, claims } = await getLogtoContext(logtoConfig);
126126

127127
return (
@@ -151,8 +151,6 @@ const Home = () => {
151151
</nav>
152152
);
153153
};
154-
155-
export default Home;
156154
```
157155

158156
<Checkpoint />

0 commit comments

Comments
 (0)