fix fetch

This commit is contained in:
Refansa 2023-10-27 19:47:27 +07:00
parent ef84273642
commit 656cadf9ce
3 changed files with 3 additions and 7 deletions

View File

@ -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)

View File

@ -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() {