Commit 61e21f6b authored by Ray Schamp's avatar Ray Schamp

Show an error if the API doesn't return class data

Fixes #747.

Also explicitly show a spinner when the component is waiting on the class API, and hide it when it returns.
parent 7ae7db76
...@@ -37,10 +37,12 @@ var StudentCompleteRegistration = intl.injectIntl(React.createClass({ ...@@ -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'})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment