mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 10:58:23 -05:00
Change logout to do a POST request
This commit is contained in:
parent
4821383d00
commit
31d4173ef5
1 changed files with 7 additions and 10 deletions
|
@ -4,7 +4,6 @@ var ReactIntl = require('react-intl');
|
||||||
var defineMessages = ReactIntl.defineMessages;
|
var defineMessages = ReactIntl.defineMessages;
|
||||||
var FormattedMessage = ReactIntl.FormattedMessage;
|
var FormattedMessage = ReactIntl.FormattedMessage;
|
||||||
var injectIntl = ReactIntl.injectIntl;
|
var injectIntl = ReactIntl.injectIntl;
|
||||||
var xhr = require('xhr');
|
|
||||||
|
|
||||||
var Api = require('../../mixins/api.jsx');
|
var Api = require('../../mixins/api.jsx');
|
||||||
var Avatar = require('../avatar/avatar.jsx');
|
var Avatar = require('../avatar/avatar.jsx');
|
||||||
|
@ -151,16 +150,14 @@ var Navigation = React.createClass({
|
||||||
},
|
},
|
||||||
handleLogOut: function (e) {
|
handleLogOut: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
xhr({
|
this.api({
|
||||||
host: '',
|
host: '',
|
||||||
uri: '/accounts/logout/'
|
method: 'post',
|
||||||
}, function (err) {
|
uri: '/accounts/logout/',
|
||||||
if (err) {
|
useCsrf: true
|
||||||
log.error(err);
|
}, function (err, body) {
|
||||||
} else {
|
if (err) return;
|
||||||
this.closeLogin();
|
if (body) log.warn('body found on logout'); // shouldn't happen
|
||||||
window.refreshSession();
|
|
||||||
}
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
handleAccountNavClick: function (e) {
|
handleAccountNavClick: function (e) {
|
||||||
|
|
Loading…
Reference in a new issue