fixed api url.

This commit is contained in:
Refansa 2023-10-27 19:39:46 +07:00
parent 8453777896
commit ef84273642
2 changed files with 4 additions and 2 deletions

1
.env
View File

@ -1,2 +1,3 @@
APP_NAME=portfolio APP_NAME=portfolio
APP_LANG=en_US APP_LANG=en_US
APP_URL=https://refansa.vercel.app

View File

@ -6,7 +6,8 @@ export const metadata: Metadata = {
} }
async function getProjectLists() { async function getProjectLists() {
const res = await fetch('http://localhost:3000/api/projects') 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.') if (!res.ok) throw new Error('Failed to fetch project lists.')