File tree 1 file changed +7
-2
lines changed
src/components/PushAudienceDialog 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export default class PushAudienceDialog extends React.Component {
55
55
audienceName : '' ,
56
56
audienceSize : undefined ,
57
57
approximate : false ,
58
+ errorMessage : undefined ,
58
59
} ;
59
60
}
60
61
@@ -91,6 +92,10 @@ export default class PushAudienceDialog extends React.Component {
91
92
}
92
93
93
94
handleAddCondition ( ) {
95
+ if ( ! this . props . schema || ! Object . keys ( this . props . schema ) . length ) {
96
+ this . setState ( { errorMessage : 'You first need to create the Installation class before adding conditions to an audience.' } ) ;
97
+ return ;
98
+ }
94
99
let available = Filters . availableFilters ( this . props . schema , this . state . filters ) ;
95
100
let field = Object . keys ( available ) [ 0 ] ;
96
101
this . setState ( ( { filters } ) => ( {
@@ -258,9 +263,9 @@ export default class PushAudienceDialog extends React.Component {
258
263
</ div >
259
264
{ futureUseSegment }
260
265
< FormNote
261
- show = { Boolean ( this . props . errorMessage && this . props . errorMessage . length > 0 ) }
266
+ show = { Boolean ( ( this . props . errorMessage && this . props . errorMessage . length > 0 ) || ( this . state . errorMessage && this . state . errorMessage . length > 0 ) ) }
262
267
color = 'red' >
263
- { this . props . errorMessage }
268
+ { this . props . errorMessage || this . state . errorMessage }
264
269
</ FormNote >
265
270
</ Modal >
266
271
) ;
You can’t perform that action at this time.
0 commit comments