prevent static optimization on root page

This commit is contained in:
Milo Schwartz 2024-10-26 21:47:12 -04:00
parent 976635e5fe
commit 4706dea3bf
No known key found for this signature in database
3 changed files with 31 additions and 37 deletions

View file

@ -24,24 +24,22 @@ export default async function RootLayout({
}>) {
const user = await verifySession();
console.log("layout.tsx user", user);
let orgs: ListOrgsResponse["orgs"] = [];
// if (user) {
// try {
// const res = await internal.get<AxiosResponse<ListOrgsResponse>>(
// `/orgs`,
// await authCookieHeader()
// );
// if (res && res.data.data.orgs) {
// orgs = res.data.data.orgs;
// }
// } catch {}
if (user) {
try {
const res = await internal.get<AxiosResponse<ListOrgsResponse>>(
`/orgs`,
await authCookieHeader()
);
if (res && res.data.data.orgs) {
orgs = res.data.data.orgs;
}
} catch {}
// if (!orgs.length) {
// redirect(`/setup`);
// }
// }
if (!orgs.length) {
redirect(`/setup`);
}
}
return (
<html suppressHydrationWarning>