Skip to content

Commit 9919b3a

Browse files
authored
fix: mark Home component as async to support await expression
The example used `await getLogtoContext()` inside a normal function, which caused a TypeScript error: 'await' expressions are only allowed within async functions and at the top levels of modules (TS1308). Fixed by marking the Home component as async.
1 parent ce070f1 commit 9919b3a

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)