I make getStaticProps in pages, in local it's work but in production doesn't work. my code is below:
import {GetStaticProps} from 'next';
export const getStaticProps: GetStaticProps = async () => {
const res = await apiAboutV2();
const data = res ?? {};
return {
props: {about: _.result(data, 'data', {})},
revalidate: true,
};
};
interface Props {
about: any;
}
export default function About({about}: Props) {
return (
<div>
{about?.history}
</div>
)
}
anyone can suggestion for me?
edit:
export const apiAboutV2 = async () => {
const uri = `${baseUrl}/api/v2/public/about`;
const res = await axios({
method: 'GET',
url: uri,
})
.then((res) => res.data)
.catch((err) => err?.response?.data || err);
return res;
};
code above is apiAboutV2