handle no data scenario

This commit is contained in:
kevmodrome 2020-09-28 10:58:06 +02:00
parent 3523b3dbf7
commit 5505ad3cda
No known key found for this signature in database
GPG Key ID: E8F9CD141E63BF38
1 changed files with 13 additions and 15 deletions

View File

@ -1,8 +1,9 @@
<script> <script>
// Import valueSetters // Import valueSetters and custom renderers
import { number } from "./valueSetters" import { number } from "./valueSetters"
import { booleanRenderer } from "./customRenderer" import { booleanRenderer } from "./customRenderer"
// These maps need to be set up to handle whatever types that are used in the models.
const setters = new Map([["number", number]]) const setters = new Map([["number", number]])
const renderers = new Map([["boolean", booleanRenderer]]) const renderers = new Map([["boolean", booleanRenderer]])
@ -27,8 +28,6 @@
console.log(schema) console.log(schema)
if (!isEmpty(datasource)) { if (!isEmpty(datasource)) {
data = await fetchData(datasource) data = await fetchData(datasource)
if (data) {
// Construct column definitions
columnDefs = Object.keys(schema).map(key => { columnDefs = Object.keys(schema).map(key => {
return { return {
valueSetter: setters.get(schema[key].type), valueSetter: setters.get(schema[key].type),
@ -41,7 +40,6 @@
} }
}) })
} }
}
dataLoaded = true dataLoaded = true
}) })