Replies: 1 comment
-
Please share a sample of the return from "/suppliers" and "/keys." |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to fetch my keys from an API endpoint that returns an array? Something about the promise is giving me the following TypeError for trying to iterate over it.
autoComplete.js:119 Uncaught (in promise) TypeError: Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a Symbol.iterator method.
data: { src: async () => { try { // Loading placeholder text document.getElementById("autoComplete").setAttribute("placeholder", "Loading..."); // Fetch External Data Source const source = await fetch("/suppliers"); const data = await source.json(); console.log(data) // Post Loading placeholder text document.getElementById("autoComplete").setAttribute("placeholder", autoCompleteJS.placeHolder); // Returns Fetched data return data; } catch (error) { return error; } }, keys: fetch("/keys").then(response => response.json()) //.then(jsonData => console.log(jsonData) ), cache:true
Beta Was this translation helpful? Give feedback.
All reactions