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">
<Grid
{API}
tableId={{ tableId: selectedView?.tableId, viewId: selectedView?.id }}
tableId={selectedView?.id}
datasourceType="viewV2"
showAvatars={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"
export default class ViewV2Fetch extends DataFetch {
@ -7,9 +9,9 @@ export default class ViewV2Fetch extends DataFetch {
async getDefinition(datasource) {
try {
const result = await this.API.fetchTableDefinition(
datasource.tableId.tableId
)
const views = get(viewsStore).list
const { tableId } = views.find(v => v.id === datasource.tableId)
const result = await this.API.fetchTableDefinition(tableId)
return result
} catch (error) {
this.store.update(state => ({
@ -23,10 +25,7 @@ export default class ViewV2Fetch extends DataFetch {
async getData() {
const { datasource } = this.options
try {
const res = await this.API.viewV2.fetch(
datasource.tableId.tableId,
datasource.tableId.viewId
)
const res = await this.API.viewV2.fetch(datasource.tableId)
return { rows: res?.rows || [] }
} catch (error) {
return { rows: [] }