diff --git a/client/src/api/datasets.ts b/client/src/api/datasets.ts index ab286ab0b54..09948b45ce2 100644 --- a/client/src/api/datasets.ts +++ b/client/src/api/datasets.ts @@ -1,5 +1,6 @@ import type { FetchArgType } from "openapi-typescript-fetch"; +import { DatasetDetails } from "@/api"; import { fetcher } from "@/api/schema"; import { withPrefix } from "@/utils/redirect"; @@ -35,6 +36,15 @@ export async function getDatasets(options: GetDatasetsOptions = {}) { return data; } +const getDataset = fetcher.path("/api/datasets/{dataset_id}").method("get").create(); + +export async function fetchDatasetDetails(params: { id: string }): Promise { + const { data } = await getDataset({ dataset_id: params.id, view: "detailed" }); + // We know that the server will return a DatasetDetails object because of the view parameter + // but the type system doesn't, so we have to cast it. + return data as unknown as DatasetDetails; +} + const updateHistoryDataset = fetcher.path("/api/histories/{history_id}/contents/{type}s/{id}").method("put").create(); export async function undeleteHistoryDataset(historyId: string, datasetId: string) { diff --git a/client/src/components/Dataset/DatasetLink/DatasetLink.vue b/client/src/components/Dataset/DatasetLink/DatasetLink.vue index 273d7631829..f4b9c2ed860 100644 --- a/client/src/components/Dataset/DatasetLink/DatasetLink.vue +++ b/client/src/components/Dataset/DatasetLink/DatasetLink.vue @@ -7,7 +7,7 @@