mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 02:56:20 -05:00
Stop spinner and display XHR errors if they occur
Resolves GH-232
This commit is contained in:
parent
c15b6a9681
commit
7ed45cb5dd
1 changed files with 4 additions and 1 deletions
|
@ -126,12 +126,14 @@ var Navigation = React.createClass({
|
||||||
json: formData,
|
json: formData,
|
||||||
useCsrf: true
|
useCsrf: true
|
||||||
}, function (err, body) {
|
}, function (err, body) {
|
||||||
|
if (err) this.setState({'loginError': err.message});
|
||||||
if (body) {
|
if (body) {
|
||||||
body = body[0];
|
body = body[0];
|
||||||
if (!body.success) {
|
if (!body.success) {
|
||||||
if (body.redirect) {
|
if (body.redirect) {
|
||||||
window.location = body.redirect;
|
window.location = body.redirect;
|
||||||
}
|
}
|
||||||
|
// Update login error message to a friendlier one if it exists
|
||||||
this.setState({'loginError': body.msg});
|
this.setState({'loginError': body.msg});
|
||||||
} else {
|
} else {
|
||||||
this.closeLogin();
|
this.closeLogin();
|
||||||
|
@ -142,8 +144,9 @@ var Navigation = React.createClass({
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
window.refreshSession();
|
window.refreshSession();
|
||||||
}
|
}
|
||||||
callback();
|
|
||||||
}
|
}
|
||||||
|
// JS error already logged by api mixin
|
||||||
|
callback();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
handleLogOut: function (e) {
|
handleLogOut: function (e) {
|
||||||
|
|
Loading…
Reference in a new issue