diff --git a/server/routers/site/getSite.ts b/server/routers/site/getSite.ts
index 4eb8ea9..85afe11 100644
--- a/server/routers/site/getSite.ts
+++ b/server/routers/site/getSite.ts
@@ -18,7 +18,6 @@ export type GetSiteResponse = {
siteId: number;
name: string;
subdomain: string;
- pubKey: string;
subnet: string;
}
@@ -59,7 +58,12 @@ export async function getSite(req: Request, res: Response, next: NextFunction):
}
return response(res, {
- data: site[0],
+ data: {
+ siteId: site[0].siteId,
+ name: site[0].name,
+ subdomain: site[0].subdomain,
+ subnet: site[0].subnet,
+ },
success: true,
error: false,
message: "Site retrieved successfully",
diff --git a/src/app/[orgId]/resources/[resourceId]/layout.tsx b/src/app/[orgId]/resources/[resourceId]/layout.tsx
index 3a443db..58d6ef6 100644
--- a/src/app/[orgId]/resources/[resourceId]/layout.tsx
+++ b/src/app/[orgId]/resources/[resourceId]/layout.tsx
@@ -12,29 +12,25 @@ export const metadata: Metadata = {
const sidebarNavItems = [
{
title: "Profile",
- href: "/configuration/resources/{resourceId}/",
- },
- {
- title: "Account",
- href: "/configuration/resources/{resourceId}/account",
+ href: "/{orgId}/resources/{resourceId}/",
},
{
title: "Appearance",
- href: "/configuration/resources/{resourceId}/appearance",
+ href: "/{orgId}/resources/{resourceId}/appearance",
},
{
title: "Notifications",
- href: "/configuration/resources/{resourceId}/notifications",
+ href: "/{orgId}/resources/{resourceId}/notifications",
},
{
title: "Display",
- href: "/configuration/resources/{resourceId}/display",
+ href: "/{orgId}/resources/{resourceId}/display",
},
]
interface SettingsLayoutProps {
children: React.ReactNode,
- params: { resourceId: string }
+ params: { resourceId: string, orgId: string }
}
export default function SettingsLayout({ children, params }: SettingsLayoutProps) {
@@ -66,7 +62,7 @@ export default function SettingsLayout({ children, params }: SettingsLayoutProps
{children}
diff --git a/src/app/[orgId]/sites/[siteId]/layout.tsx b/src/app/[orgId]/sites/[siteId]/layout.tsx
index da421e1..e161b9a 100644
--- a/src/app/[orgId]/sites/[siteId]/layout.tsx
+++ b/src/app/[orgId]/sites/[siteId]/layout.tsx
@@ -17,46 +17,45 @@ export const metadata: Metadata = {
const sidebarNavItems = [
{
title: "Profile",
- href: "/configuration/sites/{siteId}/",
- },
- {
- title: "Account",
- href: "/configuration/sites/{siteId}/account",
+ href: "/{orgId}/sites/{siteId}/",
},
{
title: "Appearance",
- href: "/configuration/sites/{siteId}/appearance",
+ href: "/{orgId}/sites/{siteId}/appearance",
},
{
title: "Notifications",
- href: "/configuration/sites/{siteId}/notifications",
+ href: "/{orgId}/sites/{siteId}/notifications",
},
{
title: "Display",
- href: "/configuration/sites/{siteId}/display",
+ href: "/{orgId}/sites/{siteId}/display",
},
]
interface SettingsLayoutProps {
children: React.ReactNode,
- params: { siteId: string }
+ params: { siteId: string, orgId: string }
}
export default async function SettingsLayout({ children, params }: SettingsLayoutProps) {
- const sessionId = cookies().get("session")?.value ?? null;
- const res = await internal
- .get>(`/site/${params.siteId}`, {
- headers: {
- Cookie: `session=${sessionId}`,
- },
- });
+ let site = null;
+ if (params.siteId !== "create") {
+ try {
+ const sessionId = cookies().get("session")?.value ?? null;
+ const res = await internal
+ .get>(`/site/${params.siteId}`, {
+ headers: {
+ Cookie: `session=${sessionId}`,
+ },
+ });
- if (!res || res.status !== 200) {
- return Failed to load site
;
+ site = res.data.data;
+ } catch {
+ return null;
+ }
}
-
- const site = res.data.data;
-
+
return (
<>
@@ -85,7 +84,7 @@ export default async function SettingsLayout({ children, params }: SettingsLayou
diff --git a/src/components/sidebar-nav.tsx b/src/components/sidebar-nav.tsx
index abfbbe0..bd8d466 100644
--- a/src/components/sidebar-nav.tsx
+++ b/src/components/sidebar-nav.tsx
@@ -1,49 +1,53 @@
"use client"
import React from 'react'
import Link from "next/link"
-import { usePathname } from "next/navigation"
+import { useParams, usePathname, useRouter } from "next/navigation"
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button"
interface SidebarNavProps extends React.HTMLAttributes {
- items: {
- href: string
- title: string
- }[]
- disabled?: boolean
+ items: {
+ href: string
+ title: string
+ }[]
+ disabled?: boolean
}
export function SidebarNav({ className, items, disabled = false, ...props }: SidebarNavProps) {
- const pathname = usePathname()
+ const pathname = usePathname();
+ const params = useParams();
+ const orgId = params.orgId as string;
+ const siteId = params.siteId as string;
+ const resourceId = params.resourceId as string;
- return (
-
+ )
}
\ No newline at end of file
diff --git a/src/providers/SiteProvider.tsx b/src/providers/SiteProvider.tsx
index b570c19..2a01bcb 100644
--- a/src/providers/SiteProvider.tsx
+++ b/src/providers/SiteProvider.tsx
@@ -5,7 +5,7 @@ import { GetSiteResponse } from "@server/routers/site/getSite";
import { ReactNode } from "react";
type LandingProviderProps = {
- site: GetSiteResponse;
+ site: GetSiteResponse | null;
children: ReactNode;
};