오랜 시간이자 마지막으로 따기 Next.js 다,그래서 나는 이것을 알고 아마가 끓여 뭔가를 내려 바보입니다. 여기에 간다. 무엇을 잘못으로 나 getStaticPaths()
값을까요? 그것은 것 같아 나는 포맷으로 정확하게 문서를 요구합니다. (값이 할당 paths
가 console.log()
'd 터미널 창에서)
export const getStaticPaths = async () => {
const paths = getEvents();
return {
paths,
fallback: false
};
};
고 getEvents()
기능:
export const getEvents = () => {
axios.post(`${globals.api_endpoint}getEvents.php`, {
action: 'getStaticPaths'
}).then((r) => {
if (!r.data.error) {
const paths = r.data.map(index => {
return {
params: {
id: index.event_id
}
};
});
console.log(paths);
return paths;
}
});
};