From ab003de13548d27091249a2f5fe7997bc0e7a5d3 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Tue, 23 Jul 2024 23:39:26 +0200 Subject: [PATCH] [#190] Change apiUrl in importRecords from /rest/records/import/{fileType} to one single endpoint /rest/records/import --- src/actions/RecordsActions.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/actions/RecordsActions.js b/src/actions/RecordsActions.js index 1838c9eb..20c0cae8 100644 --- a/src/actions/RecordsActions.js +++ b/src/actions/RecordsActions.js @@ -130,23 +130,10 @@ export function importRecords(file) { return (dispatch) => { dispatch(asyncRequest(ActionConstants.IMPORT_RECORDS_PENDING)); - const fileExtension = file.name.split(".").pop().toLowerCase(); - const formData = new FormData(); formData.append("file", file); let apiUrl = `${API_URL}/rest/records/import`; - if (fileExtension === "json") { - apiUrl = `${API_URL}/rest/records/import/json`; - } else if (["xls", "xlsx"].includes(fileExtension)) { - apiUrl = `${API_URL}/rest/records/import/excel`; - } else if (["tsv"].includes(fileExtension)) { - apiUrl = `${API_URL}/rest/records/import/tsv`; - } else { - const error = new Error("Unsupported file format"); - dispatch(asyncError(ActionConstants.IMPORT_RECORDS_ERROR, error)); - return Promise.reject(error); - } return axiosBackend .post(apiUrl, formData, {