Ghost/ghost/admin/app/services/billing.js
Nazar Gargol f1986b443b Fixed default BMA iframe state
- Upgrade flow should only be set to truthy through a direct setter
2020-04-22 18:14:58 +12:00

32 lines
767 B
JavaScript

import Service from '@ember/service';
import {computed} from '@ember/object';
import {inject as service} from '@ember/service';
export default Service.extend({
config: service(),
ghostPaths: service(),
billingWindowOpen: false,
upgrade: false,
action: null,
closeBillingWindow() {
this.set('billingWindowOpen', false);
this.set('action', null);
},
endpoint: computed('config.billingUrl', 'billingWindowOpen', 'action', function () {
let url = this.config.get('billingUrl');
if (this.get('upgrade')) {
url = this.ghostPaths.url.join(url, 'plans');
}
if (this.get('action')) {
url += `?action=${this.get('action')}`;
}
return url;
})
});