mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-07 11:30:55 +03:00
4c72c318d5
closes #2855 , closes #2848 - New mixin that utilizes NProgress for displaying a loading indictor for all routes who's model issue a "loading" event (aka: when requesting data from the server during a route change). - Also removing (the now unnecessary) "loading" template.
29 lines
946 B
JavaScript
29 lines
946 B
JavaScript
import ajax from 'ghost/utils/ajax';
|
|
import styleBody from 'ghost/mixins/style-body';
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
|
|
|
var SignoutRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, {
|
|
classNames: ['ghost-signout'],
|
|
|
|
beforeModel: function () {
|
|
var self = this;
|
|
|
|
ajax({
|
|
url: this.get('ghostPaths').adminUrl('signout'),
|
|
type: 'POST',
|
|
headers: {
|
|
'X-CSRF-Token': this.get('csrf')
|
|
}
|
|
}).then(function () {
|
|
self.notifications.showSuccess('You were successfully signed out.');
|
|
self.transitionTo('signin');
|
|
}, function (resp) {
|
|
self.notifications.showAPIError(resp, 'There was a problem logging out, please try again.');
|
|
self.transitionTo('posts');
|
|
});
|
|
}
|
|
});
|
|
|
|
export default SignoutRoute;
|