Hi,
I have an issue with wixData.get function following code:
export function notifyManufaturers (sourceId) {
wixData.get("SourceFastener", sourceId)
.then(res => console.log(res))
. **catch** (e => console.log(e));
}
Does not go neither to then nor catch. But I am sure I have an item with given id in collection “SourceFastener”. Any ideas why?
Thanks
Keep in mind that you won’t see the output in the Wix Code console, it will only appear in the browser’s Javascript console.
For example, here’s how to open Chrome’s Javascript console:
I hope this helps.
Yisrael
No. There is nothing in in both consoles. It simply is not executed.
export function notifyManufacturers (sourceId) {
**let** promise = wixData.get("SourceFastener", sourceId)
.then(res => console.log('then'))
. **catch** (e => console.log('error'))
console.log(promise)
}
I can see promise in console. But nothing else.
Is there a way to report this bug?
Thanks,
Ivan.
It is probably not a bug. Either your code is not executing, or nothing is being returned. If the code was executing, the console.log() would display in the console.
I’m sorry. I don’t quite understand what you mean.
- As far as I understand promise should be resolve or rejected hence a least one handler should be executed.
- For testing I copied an id from Database and sent it to function as sourceId. As far as I understand from documentation - wixData.get should return one entry.
None of described above is happening.
Please correct me if I’m wrong.
Thanks, Ivan
Please post the URL of your site. Only authorized Wix personnel can get access to your site in the editor.
Sure, here . I call function notifyManufacturers on button submit click line 94.
Thanks,
Ivan.
You are not properly observing the flow of execution of the Promises in the the notifyManufacturers function. The last thing that I see displayed in the console is the results of console.log(promise) , which displays promise (which is unfulfilled).
You should read the following:
Good luck,
Yisrael