Use full id
This commit is contained in:
parent
a602dcc5ec
commit
2c1aae9705
|
@ -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}
|
||||||
|
|
|
@ -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: [] }
|
||||||
|
|
Loading…
Reference in New Issue