2014-06-01 23:30:50 +04:00
|
|
|
import ajax from 'ghost/utils/ajax';
|
|
|
|
import styleBody from 'ghost/mixins/style-body';
|
2014-06-13 23:35:22 +04:00
|
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
2014-06-01 23:30:50 +04:00
|
|
|
|
2014-06-13 23:35:22 +04:00
|
|
|
var SignoutRoute = AuthenticatedRoute.extend(styleBody, {
|
2014-06-01 23:30:50 +04:00
|
|
|
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 () {
|
2014-06-17 02:54:21 +04:00
|
|
|
self.notifications.showSuccess('You were successfully signed out.');
|
2014-06-01 23:30:50 +04:00
|
|
|
self.transitionTo('signin');
|
|
|
|
}, function (resp) {
|
|
|
|
self.notifications.showAPIError(resp, 'There was a problem logging out, please try again.');
|
|
|
|
self.transitionTo('posts');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-06-13 23:35:22 +04:00
|
|
|
export default SignoutRoute;
|