Skip to content

Commit 888ea2e

Browse files
authored
fix: mark Home component as async to support await expression (#1268)
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 88dceb7 commit 888ea2e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 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 (
@@ -150,9 +150,7 @@ const Home = () => {
150150
)}
151151
</nav>
152152
);
153-
};
154-
155-
export default Home;
153+
}
156154
```
157155

158156
<Checkpoint />

0 commit comments

Comments
 (0)