Przez długi czas wywoływacz, w końcu odbiera Next.js tak, że wiem, że jest to prawdopodobnie skończy się do czegoś głupi. Tak. Co jest nie tak z moim getStaticPaths()
wartość tutaj? Wygląda na to, że sformatował go dokładnie tak, jak tego wymagają dokumenty. (Wartość przypisana paths
jest console.log()
'd w oknie terminala)
export const getStaticPaths = async () => {
const paths = getEvents();
return {
paths,
fallback: false
};
};
I getEvents()
funkcja:
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;
}
});
};