budibase/packages/frontend-core/src/fetch/ViewFetch.js

18 lines
419 B
JavaScript
Raw Normal View History

import DataFetch from "./DataFetch.js"
export default class ViewFetch extends DataFetch {
2021-12-17 19:48:44 +01:00
static getSchema(datasource, definition) {
return definition?.views?.[datasource.name]?.schema
}
async getData() {
const { datasource } = this.options
try {
const res = await this.API.fetchViewData(datasource)
return { rows: res || [] }
} catch (error) {
return { rows: [] }
}
}
}