P粉4269063692023-07-29 00:59:48
At the very least, your getPageData function itself should be an async function (for clarity of code readability) that will return the Promise returned by the getApiData call.
For example:
export default async function getPageData() { return getApiData('shared-content', 'en-us'); }
Two further tips:
You need to parse this Promise to read the data.
You can decide to do error handling here or higher up in the call hierarchy
Rule of thumb:
Async functions are just functions that return a Promise object.
The actual data will only be returned when the Promise is resolved (using await or .then())