Skip to content

Commit 5394c0b

Browse files
refactor code
1 parent e4a9c6f commit 5394c0b

File tree

7 files changed

+45
-55
lines changed

7 files changed

+45
-55
lines changed

apps/OpenSign/src/constant/Utils.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,11 +2039,20 @@ export const fetchUrl = async (url, pdfName) => {
20392039
}
20402040
};
20412041
export const getSignedUrl = async (pdfUrl, docId) => {
2042-
const signedUrl = await Parse.Cloud.run("getsignedurl", {
2043-
url: pdfUrl,
2044-
docId: docId || ""
2045-
});
2046-
return signedUrl;
2042+
//use only axios here due to public template sign
2043+
const axiosRes = await axios.post(
2044+
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
2045+
{ url: pdfUrl, docId: docId || "" },
2046+
{
2047+
headers: {
2048+
"content-type": "Application/json",
2049+
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
2050+
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
2051+
}
2052+
}
2053+
);
2054+
const url = axiosRes.data.result;
2055+
return url;
20472056
};
20482057
//handle download signed pdf
20492058
export const handleDownloadPdf = async (pdfDetails, setIsDownloading) => {

apps/OpenSign/src/pages/PdfRequestFiles.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,13 @@ import SignerListComponent from "../components/pdf/SignerListComponent";
4444
import VerifyEmail from "../components/pdf/VerifyEmail";
4545
import PdfZoom from "../components/pdf/PdfZoom";
4646
import { useTranslation } from "react-i18next";
47-
import {
48-
DownloadPdfZip,
49-
Loader,
50-
TourContentWithBtn,
51-
ModalUi,
52-
PdfDeclineModal,
53-
HandleError,
54-
LoaderWithMsg
55-
} from "../primitives";
47+
import ModalUi from "../primitives/ModalUi";
48+
import TourContentWithBtn from "../primitives/TourContentWithBtn";
49+
import HandleError from "../primitives/HandleError";
50+
import LoaderWithMsg from "../primitives/LoaderWithMsg";
51+
import DownloadPdfZip from "../primitives/DownloadPdfZip";
52+
import Loader from "../primitives/Loader";
53+
import PdfDeclineModal from "../primitives/PdfDeclineModal";
5654

5755
function PdfRequestFiles(props) {
5856
const { t } = useTranslation();

apps/OpenSign/src/pages/PlaceHolderSign.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,16 @@ import { useSelector } from "react-redux";
5252
import PdfZoom from "../components/pdf/PdfZoom";
5353
import { useTranslation } from "react-i18next";
5454
import RotateAlert from "../components/RotateAlert";
55-
import {
56-
TourContentWithBtn,
57-
ModalUi,
58-
HandleError,
59-
LoaderWithMsg,
60-
LinkUserModal,
61-
QuotaCard,
62-
LottieWithLoader,
63-
Alert,
64-
Upgrade,
65-
Loader
66-
} from "../primitives";
55+
import Loader from "../primitives/Loader";
56+
import ModalUi from "../primitives/ModalUi";
57+
import TourContentWithBtn from "../primitives/TourContentWithBtn";
58+
import HandleError from "../primitives/HandleError";
59+
import LoaderWithMsg from "../primitives/LoaderWithMsg";
60+
import LinkUserModal from "../primitives/LinkUserModal";
61+
import QuotaCard from "../primitives/QuotaCard";
62+
import LottieWithLoader from "../primitives/DotLottieReact";
63+
import Alert from "../primitives/Alert";
64+
import Upgrade from "../primitives/Upgrade";
6765

6866
function PlaceHolderSign() {
6967
const { t } = useTranslation();

apps/OpenSign/src/pages/SignyourselfPdf.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,12 @@ import VerifyEmail from "../components/pdf/VerifyEmail";
5252
import PdfZoom from "../components/pdf/PdfZoom";
5353
import { useTranslation } from "react-i18next";
5454
import RotateAlert from "../components/RotateAlert";
55-
import {
56-
DownloadPdfZip,
57-
Loader,
58-
ModalUi,
59-
TourContentWithBtn,
60-
HandleError,
61-
LoaderWithMsg
62-
} from "../primitives";
55+
import DownloadPdfZip from "../primitives/DownloadPdfZip";
56+
import Loader from "../primitives/Loader";
57+
import ModalUi from "../primitives/ModalUi";
58+
import TourContentWithBtn from "../primitives/TourContentWithBtn";
59+
import HandleError from "../primitives/HandleError";
60+
import LoaderWithMsg from "../primitives/LoaderWithMsg";
6361
//For signYourself inProgress section signer can add sign and complete doc sign.
6462
function SignYourSelf() {
6563
const { t } = useTranslation();

apps/OpenSign/src/pages/TemplatePlaceholder.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ import { useSelector } from "react-redux";
4343
import PdfZoom from "../components/pdf/PdfZoom";
4444
import { useTranslation } from "react-i18next";
4545
import RotateAlert from "../components/RotateAlert";
46-
import {
47-
TourContentWithBtn,
48-
ModalUi,
49-
HandleError,
50-
LoaderWithMsg,
51-
LinkUserModal
52-
} from "../primitives";
46+
import ModalUi from "../primitives/ModalUi";
47+
import TourContentWithBtn from "../primitives/TourContentWithBtn";
48+
import HandleError from "../primitives/HandleError";
49+
import LoaderWithMsg from "../primitives/LoaderWithMsg";
50+
import LinkUserModal from "../primitives/LinkUserModal";
51+
5352
const TemplatePlaceholder = () => {
5453
const { t } = useTranslation();
5554
const navigate = useNavigate();

apps/OpenSign/src/primitives/DownloadPdfZip.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ function DownloadPdfZip(props) {
4444
throw new Error(`Failed to fetch PDF: ${signedUrl}`);
4545
}
4646
const pdf1Blob = await pdf1Response.blob();
47-
47+
const isZip = true;
4848
// Fetch the Certificate (or generate its URL dynamically)
4949
const certificateUrl = await handleDownloadCertificate(
5050
pdfDetails,
5151
setIsDownloading,
52-
true
52+
isZip
5353
);
5454
const pdf2Response = await fetch(certificateUrl);
5555
if (!pdf2Response.ok) {

apps/OpenSign/src/primitives/index.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)