Use full id

This commit is contained in:
Adria Navarro 2023-07-19 22:57:54 +02:00
parent a602dcc5ec
commit 2c1aae9705
2 changed files with 7 additions and 8 deletions

View File

@ -9,7 +9,7 @@
<div class="wrapper"> <div class="wrapper">
<Grid <Grid
{API} {API}
tableId={{ tableId: selectedView?.tableId, viewId: selectedView?.id }} tableId={selectedView?.id}
datasourceType="viewV2" datasourceType="viewV2"
showAvatars={false} showAvatars={false}
showControls={false} showControls={false}

View File

@ -1,3 +1,5 @@
import { get } from "svelte/store"
import { views as viewsStore } from "stores/backend"
import DataFetch from "./DataFetch.js" import DataFetch from "./DataFetch.js"
export default class ViewV2Fetch extends DataFetch { export default class ViewV2Fetch extends DataFetch {
@ -7,9 +9,9 @@ export default class ViewV2Fetch extends DataFetch {
async getDefinition(datasource) { async getDefinition(datasource) {
try { try {
const result = await this.API.fetchTableDefinition( const views = get(viewsStore).list
datasource.tableId.tableId const { tableId } = views.find(v => v.id === datasource.tableId)
) const result = await this.API.fetchTableDefinition(tableId)
return result return result
} catch (error) { } catch (error) {
this.store.update(state => ({ this.store.update(state => ({
@ -23,10 +25,7 @@ export default class ViewV2Fetch extends DataFetch {
async getData() { async getData() {
const { datasource } = this.options const { datasource } = this.options
try { try {
const res = await this.API.viewV2.fetch( const res = await this.API.viewV2.fetch(datasource.tableId)
datasource.tableId.tableId,
datasource.tableId.viewId
)
return { rows: res?.rows || [] } return { rows: res?.rows || [] }
} catch (error) { } catch (error) {
return { rows: [] } return { rows: [] }