From 9727739c3d150d51403addf8aba80c165c67d17c Mon Sep 17 00:00:00 2001 From: karan Date: Thu, 23 Nov 2023 14:23:04 +0530 Subject: [PATCH] fix: minor changes in cred def id Signed-off-by: karan --- src/api/BulkIssuance.ts | 11 +---------- src/components/Issuance/BulkIssuance.tsx | 7 ++----- src/components/Issuance/HistoryDetails.tsx | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/api/BulkIssuance.ts b/src/api/BulkIssuance.ts index adfdad9e3..4b2c4b02c 100644 --- a/src/api/BulkIssuance.ts +++ b/src/api/BulkIssuance.ts @@ -1,4 +1,3 @@ -import type download from 'downloadjs'; import { apiRoutes } from '../config/apiRoutes'; import { storageKeys } from '../config/CommonConstant'; import { @@ -42,14 +41,8 @@ export const DownloadCsvTemplate = async () => { } }; -// bulk issuance - -// upload file - -export const uploadCsvFile = async (payload: any) => { +export const uploadCsvFile = async (payload: {file: Uint8Array | Blob}, credefId: string) => { const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const credefId = await getFromLocalStorage(storageKeys.CRED_DEF_ID); - const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.bulk.uploadCsv}?credDefId=${credefId}`; const axiosPayload = { @@ -66,8 +59,6 @@ export const uploadCsvFile = async (payload: any) => { } }; -//get file data - export const getCsvFileData = async ( requestId: any, pageNumber: number, diff --git a/src/components/Issuance/BulkIssuance.tsx b/src/components/Issuance/BulkIssuance.tsx index d9c0422bb..7aa2af268 100644 --- a/src/components/Issuance/BulkIssuance.tsx +++ b/src/components/Issuance/BulkIssuance.tsx @@ -39,7 +39,7 @@ const BulkIssuance = () => { const [process, setProcess] = useState(false); const [loading, setLoading] = useState(true); const [credentialOptions, setCredentialOptions] = useState([]); - const [credentialSelected, setCredentialSelected] = useState(""); + const [credentialSelected, setCredentialSelected] = useState(""); const [isFileUploaded, setIsFileUploaded] = useState(false); const [uploadedFileName, setUploadedFileName] = useState(''); const [uploadedFile, setUploadedFile] = useState(null); @@ -122,10 +122,7 @@ const BulkIssuance = () => { if (data) { const fileUrl = data; - // Adjust this based on the response structure if (fileUrl) { - // Open the file in a new tab - // window.open(data); downloadFile(fileUrl, 'downloadedFile.csv'); setSuccess('File downloaded successfully'); setProcess(false); @@ -222,7 +219,7 @@ const BulkIssuance = () => { await wait(500); - const response = await uploadCsvFile(payload); + const response = await uploadCsvFile(payload, credentialSelected); const { data } = response as AxiosResponse; if (data?.statusCode === apiStatusCodes?.API_STATUS_CREATED) { diff --git a/src/components/Issuance/HistoryDetails.tsx b/src/components/Issuance/HistoryDetails.tsx index 9e9db1555..8a14b2313 100644 --- a/src/components/Issuance/HistoryDetails.tsx +++ b/src/components/Issuance/HistoryDetails.tsx @@ -121,7 +121,7 @@ const HistoryDetails = ({ requestId }: IProps) => { }, { data: history?.error - ? history?.error.replace(/[[\]"]/g, '') + ? history?.error.replace(/[[\]"{},]/g, ' ') : '-', }, ],