Skip to content

Commit

Permalink
Refactor dataset services (fix TODOs)
Browse files Browse the repository at this point in the history
Use directly dataset API routes instead of history contents routes to avoid having to pass a history ID that is unnecessary.
  • Loading branch information
davelopez committed Oct 12, 2023
1 parent 862dc99 commit ca69990
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions client/src/components/Dataset/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ export async function updateTags(
}

export function getCompositeDatasetLink(historyDatasetId: string, path: string) {
// TODO: historyDatasetId is wrong here, we should expose the route without forcing to provide a history id
return withPrefix(`/api/histories/${historyDatasetId}/contents/${historyDatasetId}/display?filename=${path}`);
return withPrefix(`/api/datasets/${historyDatasetId}/display?filename=${path}`);
}

const getDataset = fetcher.path("/api/histories/{history_id}/contents/{id}").method("get").create();
const getDataset = fetcher.path("/api/datasets/{dataset_id}").method("get").create();
export async function getCompositeDatasetInfo(id: string) {
// TODO: ${id} as history id is wrong here, we should expose the route without forcing to provide a history id
const { data } = await getDataset({ history_id: id, id });
const { data } = await getDataset({ dataset_id: id });
return data;
}

0 comments on commit ca69990

Please sign in to comment.