File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import React from 'react';
2
2
import _ from 'lodash' ;
3
3
import Timeline from 'react-calendar-timeline' ;
4
4
import moment from 'moment' ;
5
- import { Spinner } from 'elemental' ;
5
+ import { Alert , Spinner } from 'elemental' ;
6
6
import * as http from '../lib/http' ;
7
7
import groupsJSON from '../../shared/groups.json' ;
8
8
@@ -25,12 +25,14 @@ export default React.createClass({
25
25
items : [ ] ,
26
26
groups : [ ] ,
27
27
volunteers : null ,
28
+ error : null ,
28
29
} ;
29
30
} ,
30
31
31
32
componentDidMount ( ) {
32
33
http . get ( '/api/volunteers' )
33
- . then ( ( { volunteers } ) => this . setState ( { volunteers } , this . generateItems ) ) ;
34
+ . then ( ( { volunteers } ) => this . setState ( { volunteers } , this . generateItems ) )
35
+ . catch ( ( { error } ) => this . setState ( { error } ) ) ;
34
36
} ,
35
37
36
38
generateItems ( ) {
@@ -59,6 +61,14 @@ export default React.createClass({
59
61
} ,
60
62
61
63
render ( ) {
64
+ if ( this . state . error ) {
65
+ return (
66
+ < div className = "container" style = { { marginTop : 100 } } >
67
+ < Alert type = "danger" > < strong > Error:</ strong > { this . state . error } </ Alert >
68
+ </ div >
69
+ ) ;
70
+ }
71
+
62
72
if ( this . state . volunteers === null ) {
63
73
return < div style = { { marginTop : 100 , textAlign : 'center' } } > < Spinner size = "lg" /> </ div > ;
64
74
}
You can’t perform that action at this time.
0 commit comments