mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
refactor code
This commit is contained in:
@@ -2039,11 +2039,20 @@ export const fetchUrl = async (url, pdfName) => {
|
||||
}
|
||||
};
|
||||
export const getSignedUrl = async (pdfUrl, docId) => {
|
||||
const signedUrl = await Parse.Cloud.run("getsignedurl", {
|
||||
url: pdfUrl,
|
||||
docId: docId || ""
|
||||
});
|
||||
return signedUrl;
|
||||
//use only axios here due to public template sign
|
||||
const axiosRes = await axios.post(
|
||||
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
|
||||
{ url: pdfUrl, docId: docId || "" },
|
||||
{
|
||||
headers: {
|
||||
"content-type": "Application/json",
|
||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
||||
}
|
||||
}
|
||||
);
|
||||
const url = axiosRes.data.result;
|
||||
return url;
|
||||
};
|
||||
//handle download signed pdf
|
||||
export const handleDownloadPdf = async (pdfDetails, setIsDownloading) => {
|
||||
|
||||
@@ -44,15 +44,13 @@ import SignerListComponent from "../components/pdf/SignerListComponent";
|
||||
import VerifyEmail from "../components/pdf/VerifyEmail";
|
||||
import PdfZoom from "../components/pdf/PdfZoom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
DownloadPdfZip,
|
||||
Loader,
|
||||
TourContentWithBtn,
|
||||
ModalUi,
|
||||
PdfDeclineModal,
|
||||
HandleError,
|
||||
LoaderWithMsg
|
||||
} from "../primitives";
|
||||
import ModalUi from "../primitives/ModalUi";
|
||||
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
||||
import HandleError from "../primitives/HandleError";
|
||||
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
||||
import DownloadPdfZip from "../primitives/DownloadPdfZip";
|
||||
import Loader from "../primitives/Loader";
|
||||
import PdfDeclineModal from "../primitives/PdfDeclineModal";
|
||||
|
||||
function PdfRequestFiles(props) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -52,18 +52,16 @@ import { useSelector } from "react-redux";
|
||||
import PdfZoom from "../components/pdf/PdfZoom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import RotateAlert from "../components/RotateAlert";
|
||||
import {
|
||||
TourContentWithBtn,
|
||||
ModalUi,
|
||||
HandleError,
|
||||
LoaderWithMsg,
|
||||
LinkUserModal,
|
||||
QuotaCard,
|
||||
LottieWithLoader,
|
||||
Alert,
|
||||
Upgrade,
|
||||
Loader
|
||||
} from "../primitives";
|
||||
import Loader from "../primitives/Loader";
|
||||
import ModalUi from "../primitives/ModalUi";
|
||||
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
||||
import HandleError from "../primitives/HandleError";
|
||||
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
||||
import LinkUserModal from "../primitives/LinkUserModal";
|
||||
import QuotaCard from "../primitives/QuotaCard";
|
||||
import LottieWithLoader from "../primitives/DotLottieReact";
|
||||
import Alert from "../primitives/Alert";
|
||||
import Upgrade from "../primitives/Upgrade";
|
||||
|
||||
function PlaceHolderSign() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -52,14 +52,12 @@ import VerifyEmail from "../components/pdf/VerifyEmail";
|
||||
import PdfZoom from "../components/pdf/PdfZoom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import RotateAlert from "../components/RotateAlert";
|
||||
import {
|
||||
DownloadPdfZip,
|
||||
Loader,
|
||||
ModalUi,
|
||||
TourContentWithBtn,
|
||||
HandleError,
|
||||
LoaderWithMsg
|
||||
} from "../primitives";
|
||||
import DownloadPdfZip from "../primitives/DownloadPdfZip";
|
||||
import Loader from "../primitives/Loader";
|
||||
import ModalUi from "../primitives/ModalUi";
|
||||
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
||||
import HandleError from "../primitives/HandleError";
|
||||
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
||||
//For signYourself inProgress section signer can add sign and complete doc sign.
|
||||
function SignYourSelf() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -43,13 +43,12 @@ import { useSelector } from "react-redux";
|
||||
import PdfZoom from "../components/pdf/PdfZoom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import RotateAlert from "../components/RotateAlert";
|
||||
import {
|
||||
TourContentWithBtn,
|
||||
ModalUi,
|
||||
HandleError,
|
||||
LoaderWithMsg,
|
||||
LinkUserModal
|
||||
} from "../primitives";
|
||||
import ModalUi from "../primitives/ModalUi";
|
||||
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
||||
import HandleError from "../primitives/HandleError";
|
||||
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
||||
import LinkUserModal from "../primitives/LinkUserModal";
|
||||
|
||||
const TemplatePlaceholder = () => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
@@ -44,12 +44,12 @@ function DownloadPdfZip(props) {
|
||||
throw new Error(`Failed to fetch PDF: ${signedUrl}`);
|
||||
}
|
||||
const pdf1Blob = await pdf1Response.blob();
|
||||
|
||||
const isZip = true;
|
||||
// Fetch the Certificate (or generate its URL dynamically)
|
||||
const certificateUrl = await handleDownloadCertificate(
|
||||
pdfDetails,
|
||||
setIsDownloading,
|
||||
true
|
||||
isZip
|
||||
);
|
||||
const pdf2Response = await fetch(certificateUrl);
|
||||
if (!pdf2Response.ok) {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
export { default as DownloadPdfZip } from "./DownloadPdfZip";
|
||||
export { default as ModalUi } from "./ModalUi";
|
||||
export { default as Loader } from "./Loader";
|
||||
export { default as TourContentWithBtn } from "./TourContentWithBtn";
|
||||
export { default as HandleError } from "./HandleError";
|
||||
export { default as LoaderWithMsg } from "./LoaderWithMsg";
|
||||
export { default as PdfDeclineModal } from "./PdfDeclineModal";
|
||||
export { default as LinkUserModal } from "./LinkUserModal";
|
||||
export { default as QuotaCard } from "./QuotaCard";
|
||||
export { default as LottieWithLoader } from "./DotLottieReact";
|
||||
export { default as Alert } from "./Alert";
|
||||
export { default as Upgrade } from "./Upgrade";
|
||||
Reference in New Issue
Block a user