both with a string and with a variable it seems not to work. What am I doing wrong?
API
wixData.remove("myCollection", "00001")
.then( (results) => {
let item = results; //see item below
} )
.catch( (err) => {
let errorMsg = err;
} );
My code option 1
let theImageToRemove = itemData.image3
wixData.remove("Prodotti", theImageToRemove)
.then( (results) => {
let item = results;
console.log("Results: " + results)
} )
.catch( (err) => {
let errorMsg = err;
} );
My code option 2
let theImageToRemove = itemData.image3
wixData.remove("Prodotti", "wix:image://v1/14f014_9151ad2ba9e1495a9dc061064e7c120c~mv2.jpg/AdobeStock_270808675.jpg#originWidth=10000&originHeight=9996")
.then( (results) => {
let item = results;
console.log("Results: " + results)
} )
.catch( (err) => {
let errorMsg = err;
} );
Thanks a lot for the answer! I have tried your solution and it works!
Obviously in the collection I get this error (see attached image).
Is there any way to prevent it from showing up? In any case, it shouldn't be a problem, right?
Hi Alessandro,
The remove function removes the whole record. To remove an image you could do something like this. The example presumes that you know the _id of the record that you want to alter.
wixData.get("Prodotti","6d2956ef-0ed9-44ee-a3ab-8d1a9d176364") .then((result) => { result.picture = ""; wixData.update("Prodotti", result) .then((updateResult) => { console.log("updated"); }) })