Hi guys
I'm trying to get some "hardcoded" values from an apex Method, but when I write a console.log it's comming empty.
Here's the code I'm working on:
@wire(getValues)
wiredValues({error, data})
if(data) {
console.log("Data::::::",data);
this.getVal = JSON.stringify(data);
} else if(error){
this.error = error;
this.getVal = undefined;
console.log("No values");
}
Here's my apex method(I'm trying to make kind of "fake" callout but i'm not sure if im right):
public without sharing class getSomeValues {
@AuraEnabled(cacheable = true)
public static List<wrapVal> getWrapVal() {
HttpResponse request = new HttpResponse();
request.setBody('{"Values": ["1000", "2000", "3000", "4000", "5000"]}');
Map<String, Object> results = (Map<String, Object>)
JSON.deserializeUntyped(request.getBody());
List<Object> sumVal = (List<Object>) results.get('Values');
List<wrapVal> newLstValues = new List<wrapVal>();
for (Object getValues : sumVal ) {
wrapVal newLstValue = new wrapVal();
newLstValue.nwValue = String.valueOf(getValues);
newLstValues.add(newLstValue);
System.debug("getValues::::::"+ newLstValue.nwValue);
}
return newLstValues;
}
public class wrapVal {
public String nwValue { get; set; }
}
So idk what i'm doing wrong, if can share with me some advice or documentation it'd be great. Thanks