I got a dynamic page [id] and trying to fetch data there. It works in localhost but after building in vercel its not doing anything. This is the code:
const getItems = async (id: string) => {
try {
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/operator/score/items/questionnaire/${id}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Basic ${btoa(`${process.env.NEXT_PUBLIC_API_USERNAME}:${process.env.NEXT_PUBLIC_API_PASSWORD}`)}`,
},
cache: 'no-store',
});
const data = await response.json();
return data;
} catch (error) {
console.error('Error:', error);
}
};
const ItemsPage = async ({ params }: { params: { id: string } }) => {
const data = await getItems(params.id);
return (
<Page title="Schalen">
<VerticalMargin size="small">
<PageHeader title={params.id} />
</VerticalMargin>
<MaxWidth>
<ItemsForm items={data?.items} assesmentId={params.id} />
</MaxWidth>
</Page>
);
};