diff --git a/packages/frontend-core/src/api/viewsV2.js b/packages/frontend-core/src/api/viewsV2.js index a32f4205f8..98245430d8 100644 --- a/packages/frontend-core/src/api/viewsV2.js +++ b/packages/frontend-core/src/api/viewsV2.js @@ -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` }) - }, }) diff --git a/packages/frontend-core/src/fetch/ViewV2Fetch.js b/packages/frontend-core/src/fetch/ViewV2Fetch.js index 9faea7997d..e29a4d21aa 100644 --- a/packages/frontend-core/src/fetch/ViewV2Fetch.js +++ b/packages/frontend-core/src/fetch/ViewV2Fetch.js @@ -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 => ({