@@ -93,9 +93,11 @@ function loadEpidata(
93
93
}
94
94
points . push ( new EpiPoint ( date , row [ col ] as number ) ) ;
95
95
}
96
- // overwrite default column name if there's an overwrite in columnRenamings
97
- const title = colRenamings . has ( col ) ? colRenamings . get ( col ) : col ;
98
- datasets . push ( new DataSet ( points , title , params ) ) ;
96
+ if ( points . length > 0 ) {
97
+ // overwrite default column name if there's an overwrite in columnRenamings
98
+ const title = colRenamings . has ( col ) ? colRenamings . get ( col ) : col ;
99
+ datasets . push ( new DataSet ( points , title , params ) ) ;
100
+ }
99
101
}
100
102
return new DataGroup ( name , datasets ) ;
101
103
}
@@ -140,7 +142,18 @@ export function loadDataSet(
140
142
url . searchParams . set ( 'format' , 'json' ) ;
141
143
return fetchImpl < Record < string , unknown > [ ] > ( url )
142
144
. then ( ( res ) => {
143
- return loadEpidata ( title , res , columns , columnRenamings , { _endpoint : endpoint , ...params } ) ;
145
+ const data = loadEpidata ( title , res , columns , columnRenamings , { _endpoint : endpoint , ...params } ) ;
146
+ if ( data . datasets . length == 0 ) {
147
+ return UIkit . modal
148
+ . alert (
149
+ `
150
+ <div class="uk-alert uk-alert-error">
151
+ <a href="${ url . href } ">API Link</a> returned no data.
152
+ </div>` ,
153
+ )
154
+ . then ( ( ) => null ) ;
155
+ }
156
+ return data ;
144
157
} )
145
158
. catch ( ( error ) => {
146
159
console . warn ( 'failed fetching data' , error ) ;
0 commit comments