mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-25 22:36:38 +00:00
use fullDomain from resources in get traefik config
This commit is contained in:
@@ -24,24 +24,24 @@ 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;
|
||||
}
|
||||
|
||||
if (!orgs.length) {
|
||||
redirect(`/setup`);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error fetching orgs", e);
|
||||
}
|
||||
}
|
||||
// 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`);
|
||||
// }
|
||||
// }
|
||||
|
||||
return (
|
||||
<html suppressHydrationWarning>
|
||||
|
||||
@@ -8,26 +8,30 @@ import { ArrowUpLeft, ArrowUpRight } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Page() {
|
||||
export default async function Page(props: {
|
||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
}) {
|
||||
|
||||
const params = await props.searchParams;
|
||||
const user = await verifySession();
|
||||
|
||||
console.log("page.tsx user", user);
|
||||
|
||||
if (!user) {
|
||||
redirect("/auth/login");
|
||||
// redirect("/auth/login");
|
||||
return;
|
||||
}
|
||||
|
||||
let orgs: ListOrgsResponse["orgs"] = [];
|
||||
try {
|
||||
const res = await internal.get<AxiosResponse<ListOrgsResponse>>(
|
||||
`/orgs`,
|
||||
await authCookieHeader(),
|
||||
);
|
||||
if (res && res.data.data.orgs) {
|
||||
orgs = res.data.data.orgs;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error fetching orgs", e);
|
||||
}
|
||||
// let orgs: ListOrgsResponse["orgs"] = [];
|
||||
// try {
|
||||
// const res = await internal.get<AxiosResponse<ListOrgsResponse>>(
|
||||
// `/orgs`,
|
||||
// await authCookieHeader()
|
||||
// );
|
||||
// if (res && res.data.data.orgs) {
|
||||
// orgs = res.data.data.orgs;
|
||||
// }
|
||||
// } catch (e) {}
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -35,16 +39,20 @@ export default async function Page() {
|
||||
<p>Logged in as {user.email}</p>
|
||||
</LandingProvider>
|
||||
|
||||
<div className="mt-4">
|
||||
{orgs.map((org) => (
|
||||
<Link key={org.orgId} href={`/${org.orgId}`} className="text-primary underline">
|
||||
<div className="flex items-center">
|
||||
{org.name}
|
||||
<ArrowUpRight className="w-4 h-4"/>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
{/* <div className="mt-4">
|
||||
{orgs.map((org) => (
|
||||
<Link
|
||||
key={org.orgId}
|
||||
href={`/${org.orgId}`}
|
||||
className="text-primary underline"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
{org.name}
|
||||
<ArrowUpRight className="w-4 h-4" />
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user