2015-05-25 21:10:50 -05:00
|
|
|
import Ember from 'ember';
|
2015-05-25 17:00:42 +01:00
|
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
|
|
import styleBody from 'ghost/mixins/style-body';
|
|
|
|
|
2016-01-19 07:03:27 -06:00
|
|
|
const {
|
|
|
|
inject: {service}
|
|
|
|
} = Ember;
|
2015-10-28 11:36:45 +00:00
|
|
|
|
2015-05-25 13:17:10 -05:00
|
|
|
export default AuthenticatedRoute.extend(styleBody, {
|
2015-05-25 17:00:42 +01:00
|
|
|
titleToken: 'About',
|
|
|
|
|
|
|
|
classNames: ['view-about'],
|
|
|
|
|
2016-01-19 07:03:27 -06:00
|
|
|
ghostPaths: service(),
|
|
|
|
ajax: service(),
|
2015-05-25 21:10:50 -05:00
|
|
|
|
2015-05-25 17:00:42 +01:00
|
|
|
cachedConfig: false,
|
2015-05-25 13:17:10 -05:00
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
model() {
|
|
|
|
let cachedConfig = this.get('cachedConfig');
|
2016-02-19 18:18:14 +00:00
|
|
|
let configUrl = this.get('ghostPaths.url').api('configuration', 'about');
|
2015-05-25 13:17:10 -05:00
|
|
|
|
2015-05-25 17:00:42 +01:00
|
|
|
if (cachedConfig) {
|
|
|
|
return cachedConfig;
|
|
|
|
}
|
|
|
|
|
2016-01-18 09:37:14 -06:00
|
|
|
return this.get('ajax').request(configUrl)
|
2015-10-28 11:36:45 +00:00
|
|
|
.then((configurationResponse) => {
|
2016-02-19 18:18:14 +00:00
|
|
|
let [cachedConfig] = configurationResponse.configuration;
|
2015-05-25 13:17:10 -05:00
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
this.set('cachedConfig', cachedConfig);
|
2015-05-25 13:17:10 -05:00
|
|
|
|
2015-05-25 17:00:42 +01:00
|
|
|
return cachedConfig;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|