mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
f1986b443b
- Upgrade flow should only be set to truthy through a direct setter
32 lines
767 B
JavaScript
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;
|
|
})
|
|
});
|