Ghost/ghost/admin/app/routes/billing.js
Naz d691b15f82 Added handling for /billing route with query param passing to BMA (#1551)
no issue

- This change allows to open BMA popup using external link and pass in information using query parameters. Main use case being redirects from external sites
2020-04-22 15:35:56 +12:00

27 lines
663 B
JavaScript

import Route from '@ember/routing/route';
import {inject as service} from '@ember/service';
export default Route.extend({
billing: service(),
queryParams: {
action: {refreshModel: true}
},
init() {
this._super(...arguments);
},
model(params) {
if (params.action) {
this.billing.set('action', params.action);
}
this.billing.set('billingWindowOpen', true);
// NOTE: if this route is ever triggered it was opened through external link because
// the route has no underlying templates to render we redirect to root route
this.transitionTo('/');
}
});