From 6915f51cfa85968be638c4b8d0ff57874a8376d5 Mon Sep 17 00:00:00 2001 From: pawan-live Date: Thu, 16 Jan 2025 01:17:05 +0530 Subject: [PATCH 1/5] fix: update navbar data fetch --- src/app/layout.tsx | 13 ++++++++++--- src/types/CommonTypes.ts | 15 ++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 90f1d96..410e47f 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -6,6 +6,12 @@ import { API_ENDPOINTS } from "@/config/endpoints"; import { API_URL } from "@/config"; import { DM_Sans } from "next/font/google"; import Footer from "./components/Footer"; +import { + ApiResponse, + ApiResponseSingle, + NavbarType, +} from "@/types/CommonTypes"; +import { getData } from "@/lib/helpers/dataFetchHelper"; const dmSans = DM_Sans({ subsets: ["latin"], @@ -23,13 +29,14 @@ export default async function RootLayout({ }: { children: React.ReactNode; }) { - const data = await fetch(`${API_URL}${API_ENDPOINTS.NAVBAR}`); - const navbarData = await data.json(); + const navbarResponse: ApiResponseSingle = await getData( + `${API_ENDPOINTS.NAVBAR}` + ); return ( - +
{children}