Uzun zamandır geliştirici sonunda bir sonraki telefonu aldı.js, bunun aptalca bir şeye dönüşeceğini biliyorum. Burada gider. Ne benim oldu getStaticPaths()
burada değer mi? Görünüşe göre tam olarak dokümanların gerektirdiği şekilde biçimlendirdim. (Atanacak değer paths
oluyor console.log()
'd terminal penceresinde)
export const getStaticPaths = async () => {
const paths = getEvents();
return {
paths,
fallback: false
};
};
Ve... getEvents()
işlev:
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;
}
});
};