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

17 lines
392 B
JavaScript
Raw Normal View History

import DataFetch from "./DataFetch.js"
import { fetchViewData } from "../api"
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
const res = await fetchViewData(datasource)
return {
rows: res || [],
}
}
}