mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-19 10:14:39 +02:00
prevent static optimization on root page
This commit is contained in:
parent
976635e5fe
commit
4706dea3bf
3 changed files with 31 additions and 37 deletions
|
@ -46,8 +46,6 @@ export async function listOrgs(
|
||||||
|
|
||||||
const { limit, offset } = parsedQuery.data;
|
const { limit, offset } = parsedQuery.data;
|
||||||
|
|
||||||
logger.debug("here0")
|
|
||||||
|
|
||||||
// Use the userOrgs passed from the middleware
|
// Use the userOrgs passed from the middleware
|
||||||
const userOrgIds = req.userOrgIds;
|
const userOrgIds = req.userOrgIds;
|
||||||
|
|
||||||
|
@ -66,7 +64,6 @@ export async function listOrgs(
|
||||||
message: "No organizations found for the user",
|
message: "No organizations found for the user",
|
||||||
status: HttpCode.OK,
|
status: HttpCode.OK,
|
||||||
});
|
});
|
||||||
logger.debug("here1")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const organizations = await db
|
const organizations = await db
|
||||||
|
|
|
@ -24,24 +24,22 @@ export default async function RootLayout({
|
||||||
}>) {
|
}>) {
|
||||||
const user = await verifySession();
|
const user = await verifySession();
|
||||||
|
|
||||||
console.log("layout.tsx user", user);
|
|
||||||
|
|
||||||
let orgs: ListOrgsResponse["orgs"] = [];
|
let orgs: ListOrgsResponse["orgs"] = [];
|
||||||
// if (user) {
|
if (user) {
|
||||||
// try {
|
try {
|
||||||
// const res = await internal.get<AxiosResponse<ListOrgsResponse>>(
|
const res = await internal.get<AxiosResponse<ListOrgsResponse>>(
|
||||||
// `/orgs`,
|
`/orgs`,
|
||||||
// await authCookieHeader()
|
await authCookieHeader()
|
||||||
// );
|
);
|
||||||
// if (res && res.data.data.orgs) {
|
if (res && res.data.data.orgs) {
|
||||||
// orgs = res.data.data.orgs;
|
orgs = res.data.data.orgs;
|
||||||
// }
|
}
|
||||||
// } catch {}
|
} catch {}
|
||||||
|
|
||||||
// if (!orgs.length) {
|
if (!orgs.length) {
|
||||||
// redirect(`/setup`);
|
redirect(`/setup`);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html suppressHydrationWarning>
|
<html suppressHydrationWarning>
|
||||||
|
|
|
@ -4,34 +4,33 @@ import { verifySession } from "@app/lib/auth/verifySession";
|
||||||
import { LandingProvider } from "@app/providers/LandingProvider";
|
import { LandingProvider } from "@app/providers/LandingProvider";
|
||||||
import { ListOrgsResponse } from "@server/routers/org";
|
import { ListOrgsResponse } from "@server/routers/org";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import { ArrowUpLeft, ArrowUpRight } from "lucide-react";
|
import { ArrowUpRight } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
|
||||||
export default async function Page(props: {
|
export default async function Page(props: {
|
||||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||||
}) {
|
}) {
|
||||||
|
const params = await props.searchParams; // this is needed to prevent static optimization
|
||||||
const params = await props.searchParams;
|
|
||||||
const user = await verifySession();
|
const user = await verifySession();
|
||||||
|
|
||||||
console.log("page.tsx user", user);
|
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
// redirect("/auth/login");
|
redirect("/auth/login");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let orgs: ListOrgsResponse["orgs"] = [];
|
let orgs: ListOrgsResponse["orgs"] = [];
|
||||||
// try {
|
try {
|
||||||
// const res = await internal.get<AxiosResponse<ListOrgsResponse>>(
|
const res = await internal.get<AxiosResponse<ListOrgsResponse>>(
|
||||||
// `/orgs`,
|
`/orgs`,
|
||||||
// await authCookieHeader()
|
await authCookieHeader()
|
||||||
// );
|
);
|
||||||
// if (res && res.data.data.orgs) {
|
if (res && res.data.data.orgs) {
|
||||||
// orgs = res.data.data.orgs;
|
orgs = res.data.data.orgs;
|
||||||
// }
|
}
|
||||||
// } catch (e) {}
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -39,7 +38,7 @@ export default async function Page(props: {
|
||||||
<p>Logged in as {user.email}</p>
|
<p>Logged in as {user.email}</p>
|
||||||
</LandingProvider>
|
</LandingProvider>
|
||||||
|
|
||||||
{/* <div className="mt-4">
|
<div className="mt-4">
|
||||||
{orgs.map((org) => (
|
{orgs.map((org) => (
|
||||||
<Link
|
<Link
|
||||||
key={org.orgId}
|
key={org.orgId}
|
||||||
|
@ -52,7 +51,7 @@ export default async function Page(props: {
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div> */}
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue