fix fetch
This commit is contained in:
parent
ef84273642
commit
656cadf9ce
@ -1,5 +1,5 @@
|
|||||||
import { NextResponse } from 'next/server'
|
import { NextResponse } from 'next/server'
|
||||||
import data from '../../data/projectList.json'
|
import data from '../../../data/projectList.json'
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return NextResponse.json(data)
|
return NextResponse.json(data)
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
import { Metadata } from 'next'
|
import { Metadata } from 'next'
|
||||||
import Project from './project'
|
import Project from './project'
|
||||||
|
import data from '../../data/projectList.json'
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: 'Projects',
|
title: 'Projects',
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getProjectLists() {
|
async function getProjectLists() {
|
||||||
const baseURL = process.env.APP_URL ?? 'https://refansa.vercel.app'
|
return data
|
||||||
const res = await fetch(`${baseURL}/api/projects`)
|
|
||||||
|
|
||||||
if (!res.ok) throw new Error('Failed to fetch project lists.')
|
|
||||||
|
|
||||||
return res.json()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function Projects() {
|
export default async function Projects() {
|
||||||
|
Loading…
Reference in New Issue
Block a user