mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-30 14:39:29 +02:00
fix org landing
This commit is contained in:
parent
97af632c61
commit
566e66daa4
2 changed files with 25 additions and 5 deletions
|
@ -8,7 +8,8 @@ import { AxiosResponse } from "axios";
|
||||||
import { authCookieHeader } from "@app/lib/api/cookies";
|
import { authCookieHeader } from "@app/lib/api/cookies";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { Layout } from "@app/components/Layout";
|
import { Layout } from "@app/components/Layout";
|
||||||
import { orgNavItems } from "../navigation";
|
import { orgLangingNavItems, orgNavItems, rootNavItems } from "../navigation";
|
||||||
|
import { ListUserOrgsResponse } from "@server/routers/org";
|
||||||
|
|
||||||
type OrgPageProps = {
|
type OrgPageProps = {
|
||||||
params: Promise<{ orgId: string }>;
|
params: Promise<{ orgId: string }>;
|
||||||
|
@ -43,12 +44,23 @@ export default async function OrgPage(props: OrgPageProps) {
|
||||||
redirect(`/${orgId}/settings`);
|
redirect(`/${orgId}/settings`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let orgs: ListUserOrgsResponse["orgs"] = [];
|
||||||
|
try {
|
||||||
|
const getOrgs = cache(async () =>
|
||||||
|
internal.get<AxiosResponse<ListUserOrgsResponse>>(
|
||||||
|
`/user/${user.userId}/orgs`,
|
||||||
|
await authCookieHeader()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const res = await getOrgs();
|
||||||
|
if (res && res.data.data.orgs) {
|
||||||
|
orgs = res.data.data.orgs;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UserProvider user={user}>
|
<UserProvider user={user}>
|
||||||
<Layout
|
<Layout orgId={orgId} navItems={orgLangingNavItems} orgs={orgs}>
|
||||||
orgId={orgId}
|
|
||||||
navItems={orgNavItems}
|
|
||||||
>
|
|
||||||
{overview && (
|
{overview && (
|
||||||
<div className="w-full max-w-4xl mx-auto md:mt-32 mt-4">
|
<div className="w-full max-w-4xl mx-auto md:mt-32 mt-4">
|
||||||
<OrganizationLandingCard
|
<OrganizationLandingCard
|
||||||
|
|
|
@ -9,6 +9,14 @@ import {
|
||||||
Fingerprint
|
Fingerprint
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
|
||||||
|
export const orgLangingNavItems: SidebarNavItem[] = [
|
||||||
|
{
|
||||||
|
title: "Overview",
|
||||||
|
href: "/{orgId}",
|
||||||
|
icon: <Home className="h-4 w-4" />
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
export const rootNavItems: SidebarNavItem[] = [
|
export const rootNavItems: SidebarNavItem[] = [
|
||||||
{
|
{
|
||||||
title: "Home",
|
title: "Home",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue