Tempo di sviluppatori, infine, raccogliendo Next.js, quindi so che questo è probabilmente andando a bollire giù per qualcosa di stupido. Qui va. Cosa c'è di sbagliato con il mio getStaticPaths()
qui il valore? Sembra che ho formattato esattamente come i documenti necessari. (Valore assegnato per paths
è console.log()
'd nella finestra del terminale)
export const getStaticPaths = async () => {
const paths = getEvents();
return {
paths,
fallback: false
};
};
E il getEvents()
funzione:
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;
}
});
};