2018-10-04 14:16:41 +03:00
|
|
|
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
2021-01-28 18:25:21 +03:00
|
|
|
import CurrentUserSettings from 'ghost-admin/mixins/current-user-settings';
|
2020-05-06 10:13:29 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2018-01-09 13:36:41 +03:00
|
|
|
|
2018-10-04 14:16:41 +03:00
|
|
|
export default AuthenticatedRoute.extend(CurrentUserSettings, {
|
2020-05-06 10:13:29 +03:00
|
|
|
router: service(),
|
|
|
|
|
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
|
|
|
this.router.on('routeWillChange', () => {
|
|
|
|
if (this.controller) {
|
|
|
|
this.controller.set('selectedApiKey', null);
|
|
|
|
this.controller.set('isApiKeyRegenerated', false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2018-10-04 14:16:41 +03:00
|
|
|
beforeModel() {
|
|
|
|
this._super(...arguments);
|
|
|
|
return this.get('session.user')
|
|
|
|
.then(this.transitionAuthor())
|
|
|
|
.then(this.transitionEditor());
|
2019-04-04 14:25:16 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
model(params, transition) {
|
|
|
|
// use the integrations controller to fetch all integrations and pick
|
|
|
|
// out the one we want. Allows navigation back to integrations screen
|
|
|
|
// without a loading state
|
|
|
|
return this
|
2021-01-28 18:25:21 +03:00
|
|
|
.controllerFor('integrations')
|
2019-04-04 14:25:16 +03:00
|
|
|
.integrationModelHook('slug', 'zapier', this, transition);
|
2019-05-20 18:16:19 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
buildRouteInfoMetadata() {
|
|
|
|
return {
|
|
|
|
titleToken: 'Zapier'
|
|
|
|
};
|
2018-10-04 14:16:41 +03:00
|
|
|
}
|
2018-01-09 13:36:41 +03:00
|
|
|
});
|