@mike13529
Tried to recunstruct, but because of leck of informations, could not find an end-solution.
import wixData from 'wix-data';
export async function UpdateTasks (ToUpdate) {
let success
let value = ToUpdate.value
let options = {
"suppressAuth": true,
"suppressHooks": true
};
return wixData.query("Tasks")
.eq("title",ToUpdate.record)
.find()
.then((res)=>{console.log(res)
let items = res.items
if (items[0][ToUpdate.field].length>0 && ToUpdate.value.length > 0) {
success===false
}
else {
items[0][ToUpdate.field] = value;
wixData.update("Tasks", items[0], options)
.then((x)=>{
console.log(x)
let taskstatus //??????????
success = true;
})
}
return success
});
}
How do look like your —> “toUpdate”-package? What is inside?