diff --git a/client/src/api/jobs.ts b/client/src/api/jobs.ts index 65399c0beb96..d18644d3acd3 100644 --- a/client/src/api/jobs.ts +++ b/client/src/api/jobs.ts @@ -8,3 +8,5 @@ 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 const jobsFetcher = fetcher.path("/api/jobs").method("get").create(); + +export const jobsReportError = fetcher.path("/api/jobs/{job_id}/error").method("post").create(); diff --git a/client/src/components/DatasetInformation/services.js b/client/src/components/DatasetInformation/services.js index 13c4c62bd3d6..f13b19c980af 100644 --- a/client/src/components/DatasetInformation/services.js +++ b/client/src/components/DatasetInformation/services.js @@ -2,19 +2,18 @@ import axios from "axios"; import { getAppRoot } from "onload/loadConfig"; import { rethrowSimple } from "utils/simple-error"; +import { jobsReportError } from "@/api/jobs"; + export async function sendErrorReport(dataset, message, email) { - const payload = { + const jobId = dataset.creating_job; + const request = { + job_id: jobId, dataset_id: dataset.id, message, email, }; - const url = `${getAppRoot()}api/jobs/${dataset.creating_job}/error`; - try { - const { data } = await axios.post(url, payload); - return data.messages; - } catch (e) { - rethrowSimple(e); - } + const { data } = await jobsReportError(request); + return data.messages; } export async function setAttributes(datasetId, settings, operation) {