2021-12-17 10:52:12 +01:00
|
|
|
import DataFetch from "./DataFetch.js"
|
2021-12-17 19:39:48 +01:00
|
|
|
import { fetchViewData } from "api"
|
2021-12-17 09:22:04 +01:00
|
|
|
|
2021-12-17 10:52:12 +01:00
|
|
|
export default class ViewFetch extends DataFetch {
|
2021-12-17 19:39:48 +01:00
|
|
|
static async getSchema(datasource, definition) {
|
|
|
|
const schema = definition?.views?.[datasource.name]?.schema
|
|
|
|
console.log(schema)
|
|
|
|
return schema
|
2021-12-17 09:22:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async getData() {
|
|
|
|
const { datasource } = this.options
|
|
|
|
const res = await fetchViewData(datasource)
|
2021-12-17 19:39:48 +01:00
|
|
|
console.log(res)
|
2021-12-17 09:22:04 +01:00
|
|
|
return {
|
|
|
|
rows: res || [],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|