diff --git a/src/api/verification.ts b/src/api/verification.ts index 2b90b00..c3afd90 100644 --- a/src/api/verification.ts +++ b/src/api/verification.ts @@ -15,7 +15,7 @@ export async function verification( ): Promise<[Verification | null, string?]> { try { const verificationResponse = await makeRequest({ - url: apiUrl + "/verification" + userId, + url: apiUrl + "/verification/" + userId, method: "GET", useToken: true, withCredentials: true, diff --git a/src/pages/AccountSettings/DocumentsDialog/DocumentUploadItem.tsx b/src/pages/AccountSettings/DocumentsDialog/DocumentUploadItem.tsx index 5a5205f..57c18ea 100644 --- a/src/pages/AccountSettings/DocumentsDialog/DocumentUploadItem.tsx +++ b/src/pages/AccountSettings/DocumentsDialog/DocumentUploadItem.tsx @@ -26,8 +26,6 @@ pdfjs.GlobalWorkerOptions.workerSrc = new URL( import.meta.url ).toString(); -const DEFAULT_DOCUMENT_URL = "https://hub.pena.digital"; - export default function DocumentUploadItem({ text, document, @@ -43,11 +41,10 @@ export default function DocumentUploadItem({ } const downloadFile = async () => { - if (!document.file) { - const { data } = await axios.get( - documentUrl || DEFAULT_DOCUMENT_URL, - { responseType: "arraybuffer" } - ); + if (!document.file && documentUrl) { + const { data } = await axios.get(documentUrl, { + responseType: "arraybuffer", + }); if (!data) { return; @@ -58,9 +55,11 @@ export default function DocumentUploadItem({ return; } - const binaryFile = await readFile(document.file, "binary"); + if (document.file) { + const binaryFile = await readFile(document.file, "binary"); - downloadFileToDevice(binaryFile.name, Buffer.from(binaryFile.content)); + downloadFileToDevice(binaryFile.name, Buffer.from(binaryFile.content)); + } }; return ( @@ -97,9 +96,7 @@ export default function DocumentUploadItem({ multiple accept={accept} /> - +