0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/client/routes/signout.js
Matt Enlow 065cbc569d Change posts, post and signout routes to be AuthenticatedRoutes
No issue
The following is a list of routes which are not authenticated
- placeholder routes: `editor` and `content`
- `application`
- password routes: `forgotten`, `reset`, `signin`, `signup`
2014-06-13 14:13:07 -06:00

28 lines
893 B
JavaScript

import ajax from 'ghost/utils/ajax';
import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';
var SignoutRoute = AuthenticatedRoute.extend(styleBody, {
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 () {
// @TODO: new CSRF token to enable logging back in w/o refreshing - see issue #2861 for details
self.transitionTo('signin');
}, function (resp) {
self.notifications.showAPIError(resp, 'There was a problem logging out, please try again.');
self.transitionTo('posts');
});
}
});
export default SignoutRoute;