【发布时间】:2021-11-08 20:35:35
【问题描述】:
试图从 API 获取数据,以便从 gatsby 查询该数据并显示它,但是 ????????️
盖茨比开发
SyntaxError: Unexpected token 'export'
何时:
./gatsby-node.js
sync function fetchWinesAndTurnIntoNodes() {
const res = await fetch('https://api.sampleapis.com/wines/reds');
const wines = await res.json();
console.log(wines)
}
export async function sourceNodes(params) {
await Promise.all([await fetchWinesAndTurnIntoNodes(params)]);
}
【问题讨论】: