Skip to content

Commit

Permalink
fix: minor changes in cred def id
Browse files Browse the repository at this point in the history
Signed-off-by: karan <[email protected]>
  • Loading branch information
16-karan committed Nov 23, 2023
1 parent 845f3c5 commit 9727739
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
11 changes: 1 addition & 10 deletions src/api/BulkIssuance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type download from 'downloadjs';
import { apiRoutes } from '../config/apiRoutes';
import { storageKeys } from '../config/CommonConstant';
import {
Expand Down Expand Up @@ -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 = {
Expand All @@ -66,8 +59,6 @@ export const uploadCsvFile = async (payload: any) => {
}
};

//get file data

export const getCsvFileData = async (
requestId: any,
pageNumber: number,
Expand Down
7 changes: 2 additions & 5 deletions src/components/Issuance/BulkIssuance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const BulkIssuance = () => {
const [process, setProcess] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(true);
const [credentialOptions, setCredentialOptions] = useState([]);
const [credentialSelected, setCredentialSelected] = useState<string>("");
const [credentialSelected, setCredentialSelected] = useState<string>("");
const [isFileUploaded, setIsFileUploaded] = useState(false);
const [uploadedFileName, setUploadedFileName] = useState('');
const [uploadedFile, setUploadedFile] = useState(null);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Issuance/HistoryDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const HistoryDetails = ({ requestId }: IProps) => {
},
{
data: history?.error
? history?.error.replace(/[[\]"]/g, '')
? history?.error.replace(/[[\]"{},]/g, ' ')
: '-',
},
],
Expand Down

0 comments on commit 9727739

Please sign in to comment.