mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 09:35:56 -05:00
Merge pull request #751 from rschamp/bugfix/747
Show an error if the API doesn't return class data
This commit is contained in:
commit
401edb354d
1 changed files with 3 additions and 1 deletions
|
@ -37,10 +37,12 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({
|
||||||
this.props.session.session.permissions &&
|
this.props.session.session.permissions &&
|
||||||
this.props.session.session.permissions.student) {
|
this.props.session.session.permissions.student) {
|
||||||
var classroomId = this.props.session.session.user.classroomId;
|
var classroomId = this.props.session.session.user.classroomId;
|
||||||
|
this.setState({waiting: true});
|
||||||
api({
|
api({
|
||||||
uri: '/classrooms/' + classroomId
|
uri: '/classrooms/' + classroomId
|
||||||
}, function (err, body, res) {
|
}, function (err, body, res) {
|
||||||
if (err || res.statusCode === 404) {
|
this.setState({waiting: false});
|
||||||
|
if (err || res.statusCode !== 200) {
|
||||||
return this.setState({
|
return this.setState({
|
||||||
registrationErrors: {
|
registrationErrors: {
|
||||||
__all__: this.props.intl.formatMessage({id: 'studentRegistration.classroomApiGeneralError'})
|
__all__: this.props.intl.formatMessage({id: 'studentRegistration.classroomApiGeneralError'})
|
||||||
|
|
Loading…
Reference in a new issue