Issue:
getServerSideProps or getStaticPropsnpm run build then npm run start from my local machine but does on live site and npm run devCode for page:
const Index = ({ properties, total }) => {
return (
<Container>
<DashboardDrawer />
<Search />
<PropertyList properties={properties} />
<Pagination page={1} total={total} />
</Container>
);
};
export default Index;
export const getServerSideProps = async ({ query: { page = 1 } }) => {
// Calculate start page
const start = +page === 1 ? 0 : (+page - 1) * PER_PAGE;
// Fetch total/count
const totalRes = await fetch(`${API_URL}/properties/count`);
const total = await totalRes.json();
// Fetch properties
const propertyRes = await fetch(
`${API_URL}/properties?_limit=${PER_PAGE}&_start=${start}`
);
const properties = await propertyRes.json();
return {
props: { properties, page: +page, total },
};
};