Use table endpoint for view schema

This commit is contained in:
Adria Navarro 2023-07-21 13:25:13 +02:00
parent 4c3bfdd8b2
commit 54c3791b25
2 changed files with 3 additions and 8 deletions

View File

@ -26,11 +26,4 @@ export const buildViewV2Endpoints = API => ({
delete: async 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` })
},
})

View File

@ -7,7 +7,9 @@ export default class ViewV2Fetch extends DataFetch {
async getDefinition(datasource) {
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 }
} catch (error) {
this.store.update(state => ({