diff --git a/client/src/api/jobs.ts b/client/src/api/jobs.ts index 294f7326b3a4..d914f11a28ca 100644 --- a/client/src/api/jobs.ts +++ b/client/src/api/jobs.ts @@ -7,8 +7,6 @@ export const getJobDetails = fetcher.path("/api/jobs/{job_id}").method("get").cr export const jobLockStatus = fetcher.path("/api/job_lock").method("get").create(); export const jobLockUpdate = fetcher.path("/api/job_lock").method("put").create(); -export const fetchJobDestinationParams = fetcher.path("/api/jobs/{job_id}/destination_params").method("get").create(); - export type ShowFullJobResponse = components["schemas"]["ShowFullJobResponse"]; export type JobDetails = components["schemas"]["ShowFullJobResponse"] | components["schemas"]["EncodedJobDetails"]; export const fetchJobDetails = fetcher.path("/api/jobs/{job_id}").method("get").create(); diff --git a/client/src/stores/jobDestinationParametersStore.ts b/client/src/stores/jobDestinationParametersStore.ts index eb4f48b214ea..04b6376af781 100644 --- a/client/src/stores/jobDestinationParametersStore.ts +++ b/client/src/stores/jobDestinationParametersStore.ts @@ -1,12 +1,24 @@ import { defineStore } from "pinia"; -import { fetchJobDestinationParams, type JobDestinationParams } from "@/api/jobs"; -import { useKeyedCache } from "@/composables/keyedCache"; +import { client } from "@/api"; +import { type JobDestinationParams } from "@/api/jobs"; +import { type FetchParams, useKeyedCache } from "@/composables/keyedCache"; +import { rethrowSimple } from "@/utils/simple-error"; export const useJobDestinationParametersStore = defineStore("jobDestinationParametersStore", () => { - const { storedItems, getItemById, isLoadingItem } = useKeyedCache((params) => - fetchJobDestinationParams({ job_id: params.id }) - ); + async function fetchJobDestinationParams(params: FetchParams): Promise { + const { data, error } = await client.GET("/api/jobs/{job_id}/destination_params", { + params: { + path: { job_id: params.id }, + }, + }); + if (error) { + rethrowSimple(error); + } + return data; + } + + const { storedItems, getItemById, isLoadingItem } = useKeyedCache(fetchJobDestinationParams); return { storedJobDestinationParameters: storedItems,