Merge pull request #751 from rschamp/bugfix/747

Show an error if the API doesn't return class data
This commit is contained in:
Ray Schamp 2016-07-25 11:46:03 -04:00 committed by GitHub
commit 401edb354d

View file

@ -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'})