Skip to content

Commit

Permalink
open pdf file preview in new tab (ohcnetwork#6226)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 authored Sep 6, 2023
1 parent 8a6e526 commit b94851c
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/Components/Patient/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,20 @@ export const FileUpload = (props: FileUploadProps) => {
};
const responseData = await dispatch(retrieveUpload(data, id));
const file_extension = getExtension(responseData.data.read_signed_url);
setFileState({
...file_state,
open: true,
name: responseData.data.name,
extension: file_extension,
isImage: ExtImage.includes(file_extension),
});
downloadFileUrl(responseData.data.read_signed_url);
setFileUrl(responseData.data.read_signed_url);
if (file_extension === "pdf") {
window.open(responseData.data.read_signed_url, "_blank");
setFileState({ ...file_state, open: false });
} else {
setFileState({
...file_state,
open: true,
name: responseData.data.name,
extension: file_extension,
isImage: ExtImage.includes(file_extension),
});
downloadFileUrl(responseData.data.read_signed_url);
setFileUrl(responseData.data.read_signed_url);
}
};

const validateEditFileName = (name: any) => {
Expand Down Expand Up @@ -1457,7 +1462,7 @@ export const FileUpload = (props: FileUploadProps) => {
</ButtonV2>
</div>
)}
<div className="flex flex-col md:flex-row items-center gap-4">
<div className="flex flex-col items-center gap-4 md:flex-row">
<VoiceRecorder
createAudioBlob={createAudioBlob}
confirmAudioBlobExists={confirmAudioBlobExists}
Expand Down

0 comments on commit b94851c

Please sign in to comment.