So, I am doing this:
this.pendingAction = promiseCache(getPromotions, {sellerId : this.item.seller_id, params : null} )
promiseCache is what is sounds like. I pass it the imported apex method I want to call imperatively, and the parameters. 'SellerId' is a String, as defined in the method:
@AuraEnabled
public static String getPromotions(String sellerId, Map<String, Object> params){
System.debug('lwcPromotionsController sellerId: ' + sellerId);
String token = AppConnectionController.getTokenFromSeller(sellerId);
MLPromotionManager manager = new MLPromotionManager(token); //pasarle token dsp
return manager.userPromotionsRaw(sellerId, params);
}
For some reason, in the debug it shows a null value. I already made a console.log of the value i'm passing (this.item.seller_id) and it looks fine, and checked what data type the field is in salesforce and it is a text field. What is happening?
EDIT: here is the promiseCache method, in case it has something to do with it:
async function promiseCache(promise, params) {
params = params || {};
promiseCache.cache = promiseCache.cache || new Map();
promiseCache[promise] = promiseCache[promise] || {};
const hash = JSON.stringify(params);
if (!promiseCache.cache[promise][hash]) promiseCache.cache[promise][hash] = promise(params);
return promiseCache.cache[promise][hash];
}