I am using Ember for my webapp and I have this piece of code :
canAcceptPayPal: computed('data.event.paymentCurrency', function() {
return this.get('store').queryRecord('setting', {})
.then(setting => {
console.log(setting);
console.log(setting.paypalSandboxUsername || setting.paypalLiveUsername);
return false;
});
}),
But this only returns a promise and not the boolean value. I am using it in handlebars as :
{{#if canAcceptPayPal}}
What am I missing here?
Solution
As Amandan pointed out, re-rendering inside the then call worked:
canAcceptPayPal: computed('data.event.paymentCurrency', function() {
this.get('store').queryRecord('setting', {})
.then(setting => {
this.set('canAcceptPayPal', (setting.paypalSandboxUsername || setting.paypalLiveUsername) && find(paymentCurrencies, ['code', this.get('data.event.paymentCurrency')]).paypal);
this.rerender();
});
}),