diff --git a/src/pages/pdf/PdfSearchPage/PdfSearchForm.js b/src/pages/pdf/PdfSearchPage/PdfSearchForm.js
index 0cfc1a1..5bd5839 100644
--- a/src/pages/pdf/PdfSearchPage/PdfSearchForm.js
+++ b/src/pages/pdf/PdfSearchPage/PdfSearchForm.js
@@ -86,15 +86,15 @@ const PdfSearchForm = ({applySearch, setExpanded,expanded, clientId}) => {
};
const createFormIDA = () => {
- navigate(`/pdf/newIDA/-${clientId}T${1}`);
+ navigate(`/pdf/newIDA/${clientId}`);
};
const createFormFNA = () => {
- navigate(`/pdf/newFNA/-${clientId}T${1}`);
+ navigate(`/pdf/newFNA/${clientId}`);
};
const createFormHSBCFIN = () => {
- navigate(`/pdf/newHSBCFIN/-${clientId}T${1}`);
+ navigate(`/pdf/newHSBCFIN/${clientId}`);
};
const onSubmit = (data) => {
diff --git a/src/pages/pdf/PdfViewer/index.js b/src/pages/pdf/PdfViewer/index.js
index a665a65..d3c130c 100644
--- a/src/pages/pdf/PdfViewer/index.js
+++ b/src/pages/pdf/PdfViewer/index.js
@@ -1,7 +1,11 @@
import React, { useEffect, useRef, useState } from 'react';
+import { useParams } from 'react-router-dom'; // Import useParams
import { apiPath, GET_PDF_PATH } from "../../../auth/utils";
-const PdfViewer = ({ pdfUrl, clientId, formCode }) => {
+const PdfViewer = ({ pdfUrl, formCode }) => {
+ const { id } = useParams();
+ pdfUrl = pdfUrl + "&clientId=" + id;
+
const viewerRef = useRef(null);
const [error, setError] = useState(null);
@@ -69,7 +73,7 @@ const PdfViewer = ({ pdfUrl, clientId, formCode }) => {
window.AdobeDC.View.Enum.CallbackType.SAVE_API,
async (metaData, content, options) => {
try {
- const saveUrl = `http://localhost:8090/api/pdf2/save-pdf?clientId=${encodeURIComponent(clientId)}&formCode=${encodeURIComponent(formCode)}`;
+ const saveUrl = `http://localhost:8090/api/pdf2/save-pdf?clientId=${encodeURIComponent(id)}&formCode=${encodeURIComponent(formCode)}`;
console.log('Saving to:', saveUrl);
console.log('Authorization header:', `Bearer ${token}`);
const response = await fetch(saveUrl, {
diff --git a/src/routes/ClientRoutes.js b/src/routes/ClientRoutes.js
index 18d43dc..2836404 100644
--- a/src/routes/ClientRoutes.js
+++ b/src/routes/ClientRoutes.js
@@ -6,7 +6,7 @@ import MainLayout from "../layout/MainLayout";
import {handleRouteAbility} from "../utils/CommonFunction";
import {Navigate} from "react-router";
import AbilityContext from "../components/AbilityProvider";
-import { appURL, GET_PDF_PATH } from "../auth/utils";
+import { apiPath, appURL, GET_PDF_PATH } from "../auth/utils";
// render - login
const ClientSearchPage = Loadable(lazy( () => import('pages/client/ClientSearchPage')));
@@ -80,7 +80,9 @@ const ClientRoutes =() => {
element: (
handleRouteAbility(
ability.can('VIEW', 'DASHBOARD'),
- ,
+ ,
)
),
@@ -90,7 +92,9 @@ const ClientRoutes =() => {
element: (
handleRouteAbility(
ability.can('VIEW', 'DASHBOARD'),
- ,
+ ,
)
),
@@ -101,12 +105,11 @@ const ClientRoutes =() => {
element: (
handleRouteAbility(
ability.can('VIEW', 'DASHBOARD'),
- ,
+ />,
+
)
),
},