Apex methods that are to be cached must be marked as @AuraEnabled(cacheable=true) client side
@wire(updateLots,{victim : '$payedLots'})
updateLots(data, error) {
console.log('inside payed');
if(data) {
console.log(data);
}
if(error) {
console.log(JSON.stringify(error));
}
}
and server side
@AuraEnabled
public static string updateLots(List<String> victim) {
try {
List<Lot__c> lotList = [select id from Lot__c where id in :victim];
for(Lot__c lot : lotList) {
lot.payed__c = true;
}
update lotList;
}
catch(DmlException e) {
return e.getMessage();
}
return 'Success';
}
Can anyone tells me what do I do wrong?