diff --git a/app/api/projects/[id]/.temp b/app/api/projects/route.ts similarity index 100% rename from app/api/projects/[id]/.temp rename to app/api/projects/route.ts diff --git a/app/api/services/[id]/route.ts b/app/api/services/[id]/route.ts index 7a0914c..49402bb 100644 --- a/app/api/services/[id]/route.ts +++ b/app/api/services/[id]/route.ts @@ -1,9 +1,6 @@ const BACKEND_URL = process.env.BACKEND_URL; -export async function GET( - _request: Request, - { params }: { params: Promise<{ id: string }> }, -) { +export async function GET({ params }: { params: Promise<{ id: string }> }) { const { id } = await params; const response = await fetch(`${BACKEND_URL}/services/${id}`); @@ -18,10 +15,7 @@ export async function GET( return Response.json(data); } -export async function DELETE( - _request: Request, - { params }: { params: Promise<{ id: string }> }, -) { +export async function DELETE({ params }: { params: Promise<{ id: string }> }) { const { id } = await params; const response = await fetch(`${BACKEND_URL}/services/${id}`, { method: "DELETE", diff --git a/app/api/services/route.ts b/app/api/services/route.ts index 6c2c440..7c2920f 100644 --- a/app/api/services/route.ts +++ b/app/api/services/route.ts @@ -1,6 +1,8 @@ const BACKEND_URL = process.env.BACKEND_URL; export async function GET() { + console.log("Made it to the GET SERVICES ROUTE!"); + const response = await fetch(`${BACKEND_URL}/services/all`); if (!response.ok) { diff --git a/app/api/users/[id]/.temp b/app/api/users/[id]/route.ts similarity index 100% rename from app/api/users/[id]/.temp rename to app/api/users/[id]/route.ts diff --git a/components/layout/Header.tsx b/components/layout/Header.tsx index 3da5a84..19eeb69 100644 --- a/components/layout/Header.tsx +++ b/components/layout/Header.tsx @@ -1,7 +1,3 @@ -"use client"; - -import { useEffect, useState } from "react"; - import Hyperlink from "@/components/ui/Hyperlink"; import { getServices } from "@/lib/api/helpers/services"; import { Service } from "@/lib/api/types"; @@ -44,19 +40,11 @@ const defaultServices: Service[] = [ }, ]; -export default function Header() { - const [services, setServices] = useState(defaultServices); - useEffect(() => { - getServices() - .then((services) => { - if (services.length > 0) { - setServices(services); - } - }) - .catch(() => { - // Keep default services if the backend is not reached :C - }); - }, []); +export default async function Header() { + let services = await getServices(); + if (services.length < 1) { + services = defaultServices; + } return (