If I’m storing a static json file within weweb assets to use as a collection. What is the recommended method to call that file?
I tried multiple code snippets using JavaScript as the source, however, although it returns a ‘successfully fetched’ message it says the object is empty.
Inserting the url into a REST API call successfully returns the data.
I’m wondering what the best method is, and if JavaScript is the recommendation, what do i need to fix in the javascript code to make that work?
Any reason why you use both fetch and axios?
You are returning data from axios, this is your collection data, and logging the data from fetch.
From your screenshot I can see that the logged data is an array, so probably for your collection data.results is empty.
Have you tried to return only response.data?
The short answer is I’m just trying to work it out as a go so very limited knowledge about the code at the moment.
The frustrating thing is, I just returned to using the sample javascript code provided during configuration and now it works. And, that is after previously getting an empty response, and Access-Control errors. So now I’m confused as to what was happening before.