From 656cadf9cefbbb86b8207fe5123bd30eab4e72ff Mon Sep 17 00:00:00 2001 From: Refansa Date: Fri, 27 Oct 2023 19:47:27 +0700 Subject: [PATCH] fix fetch --- src/app/api/projects/route.ts | 2 +- src/app/projects/page.tsx | 8 ++------ src/{app => }/data/projectList.json | 0 3 files changed, 3 insertions(+), 7 deletions(-) rename src/{app => }/data/projectList.json (100%) diff --git a/src/app/api/projects/route.ts b/src/app/api/projects/route.ts index 5d75e29..a9400f2 100644 --- a/src/app/api/projects/route.ts +++ b/src/app/api/projects/route.ts @@ -1,5 +1,5 @@ import { NextResponse } from 'next/server' -import data from '../../data/projectList.json' +import data from '../../../data/projectList.json' export async function GET() { return NextResponse.json(data) diff --git a/src/app/projects/page.tsx b/src/app/projects/page.tsx index 40e57c9..244ed91 100644 --- a/src/app/projects/page.tsx +++ b/src/app/projects/page.tsx @@ -1,17 +1,13 @@ import { Metadata } from 'next' import Project from './project' +import data from '../../data/projectList.json' export const metadata: Metadata = { title: 'Projects', } async function getProjectLists() { - const baseURL = process.env.APP_URL ?? 'https://refansa.vercel.app' - const res = await fetch(`${baseURL}/api/projects`) - - if (!res.ok) throw new Error('Failed to fetch project lists.') - - return res.json() + return data } export default async function Projects() { diff --git a/src/app/data/projectList.json b/src/data/projectList.json similarity index 100% rename from src/app/data/projectList.json rename to src/data/projectList.json