mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 15:37:32 +08:00
f7e404b4e9
Switches the 12 cache-backed fetch handlers across 6 store/api files from rethrowSimple to rethrowSimpleWithStatus so that the keyedCache retry logic can distinguish retryable server errors from permanent client errors. The cancelWorkflowScheduling handler (a DELETE, not a cache handler) keeps using rethrowSimple.
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { defineStore } from "pinia";
|
|
|
|
import { GalaxyApi } from "@/api";
|
|
import type { DatasetExtraFiles } from "@/api/datasets";
|
|
import { type FetchParams, useKeyedCache } from "@/composables/keyedCache";
|
|
import { rethrowSimpleWithStatus } from "@/utils/simple-error";
|
|
|
|
export const useDatasetExtraFilesStore = defineStore("datasetExtraFilesStore", () => {
|
|
async function fetchDatasetExtraFiles(params: FetchParams): Promise<DatasetExtraFiles> {
|
|
const { data, error, response } = await GalaxyApi().GET("/api/datasets/{dataset_id}/extra_files", {
|
|
params: { path: { dataset_id: params.id } },
|
|
});
|
|
if (error) {
|
|
rethrowSimpleWithStatus(error, response);
|
|
}
|
|
return data;
|
|
}
|
|
|
|
const { storedItems, getItemById, isLoadingItem, fetchItemById } =
|
|
useKeyedCache<DatasetExtraFiles>(fetchDatasetExtraFiles);
|
|
|
|
return {
|
|
storedDatasetExtraFiles: storedItems,
|
|
getDatasetExtraFiles: getItemById,
|
|
isLoadingDatasetExtraFiles: isLoadingItem,
|
|
fetchDatasetExtFilesByDatasetId: fetchItemById,
|
|
};
|
|
});
|