Use table endpoint for view schema
This commit is contained in:
parent
4c3bfdd8b2
commit
54c3791b25
|
@ -26,11 +26,4 @@ export const buildViewV2Endpoints = API => ({
|
||||||
delete: async viewId => {
|
delete: async viewId => {
|
||||||
return await API.delete({ url: `/api/v2/views/${viewId}` })
|
return await API.delete({ url: `/api/v2/views/${viewId}` })
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* Returns schema of a view
|
|
||||||
* @param viewId the id of the view
|
|
||||||
*/
|
|
||||||
getSchema: async viewId => {
|
|
||||||
return await API.get({ url: `/api/v2/views/${viewId}/schema` })
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,7 +7,9 @@ export default class ViewV2Fetch extends DataFetch {
|
||||||
|
|
||||||
async getDefinition(datasource) {
|
async getDefinition(datasource) {
|
||||||
try {
|
try {
|
||||||
const { schema } = await this.API.viewV2.getSchema(datasource.id)
|
const table = await this.API.fetchTableDefinition(datasource.tableId)
|
||||||
|
const view = table.views.find(v => v.id === datasource.id)
|
||||||
|
const { schema } = view
|
||||||
return { schema }
|
return { schema }
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.store.update(state => ({
|
this.store.update(state => ({
|
||||||
|
|
Loading…
Reference in New Issue