diff --git a/apps/OpenSign/src/routes/Report.js b/apps/OpenSign/src/routes/Report.js
index d82dc3630..efec224ac 100644
--- a/apps/OpenSign/src/routes/Report.js
+++ b/apps/OpenSign/src/routes/Report.js
@@ -12,14 +12,37 @@ const Report = () => {
const [isLoader, setIsLoader] = useState(true);
const [reportName, setReportName] = useState("");
const [actions, setActions] = useState([]);
+ const [isNextRecord, setIsNextRecord] = useState(false);
+ const [isMoreDocs, setIsMoreDocs] = useState(true);
+ const abortController = new AbortController();
+
+ // below useEffect is call when id param change
useEffect(() => {
setReportName("");
+ setList([]);
getReportData();
+
+ // Function returned from useEffect is called on unmount
+ return () => {
+ setIsLoader(true);
+ setList([]);
+ setIsNextRecord(false);
+ // Here it'll abort the fetch
+ abortController.abort();
+ };
// eslint-disable-next-line
}, [id]);
- const getReportData = async () => {
- setIsLoader(true);
+ // below useEffect call when isNextRecord state is true and fetch next record
+ useEffect(() => {
+ if (isNextRecord) {
+ getReportData(List.length, 200);
+ }
+ // eslint-disable-next-line
+ }, [isNextRecord]);
+
+ const getReportData = async (skipUserRecord = 0, limit = 200) => {
+ // setIsLoader(true);
const json = reportJson(id);
if (json) {
setActions(json.actions);
@@ -39,8 +62,11 @@ const Report = () => {
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
};
try {
- const url = `${serverURL}?where=${strParams}&keys=${strKeys}&order=${orderBy}&include=AuditTrail.UserPtr`;
- const res = await axios.get(url, { headers: headers });
+ const url = `${serverURL}?where=${strParams}&keys=${strKeys}&order=${orderBy}&skip=${skipUserRecord}&limit=${limit}&include=AuditTrail.UserPtr`;
+ const res = await axios.get(url, {
+ headers: headers,
+ signal: abortController.signal // is used to cancel fetch query
+ });
if (id === "4Hhwbp482K") {
const listData = res.data?.results.filter(
(x) => x.Signers.length > 0
@@ -66,14 +92,35 @@ const Report = () => {
}
}
}
- setList(arr);
+ if (arr.length === 10) {
+ setIsMoreDocs(true);
+ } else {
+ setIsMoreDocs(false);
+ }
+ setList((prevRecord) =>
+ prevRecord.length > 0 ? [...prevRecord, ...arr] : arr
+ );
} else {
- setList(res.data?.results);
+ if (res.data.results.length === 10) {
+ setIsMoreDocs(true);
+ console.log("here");
+ } else {
+ setIsMoreDocs(false);
+ }
+ setIsNextRecord(false);
+ setList((prevRecord) =>
+ prevRecord.length > 0
+ ? [...prevRecord, ...res.data.results]
+ : res.data.results
+ );
}
setIsLoader(false);
} catch (err) {
- console.log("err ", err);
- setIsLoader(false);
+ const isCancel = axios.isCancel(err);
+ if (!isCancel) {
+ console.log("err ", err);
+ setIsLoader(false);
+ }
}
} else {
setIsLoader(false);
@@ -106,6 +153,8 @@ const Report = () => {
ReportName={reportName}
List={List}
actions={actions}
+ setIsNextRecord={setIsNextRecord}
+ isMoreDocs={isMoreDocs}
/>
) : (
diff --git a/apps/OpenSign/src/routes/Signup.js b/apps/OpenSign/src/routes/Signup.js
index ea3481cb7..6378e6785 100644
--- a/apps/OpenSign/src/routes/Signup.js
+++ b/apps/OpenSign/src/routes/Signup.js
@@ -251,7 +251,7 @@ const Signup = (props) => {
element.pageType
);
setState({ loading: false });
- navigate("/login");
+ navigate("/");
} else {
extendedInfo.forEach((x) => {
if (x.TenantId) {
diff --git a/apps/OpenSignServer/index.js b/apps/OpenSignServer/index.js
index f0d494c44..814d9cf58 100644
--- a/apps/OpenSignServer/index.js
+++ b/apps/OpenSignServer/index.js
@@ -63,6 +63,7 @@ export const config = {
publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/app',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'Open Sign',
+ allowClientClassCreation: false,
emailAdapter: process.env.MAILGUN_API_KEY
? {
module: 'parse-server-api-mail-adapter',
diff --git a/microfrontends/SignDocuments/package.json b/microfrontends/SignDocuments/package.json
index 3c8e28903..97970e988 100644
--- a/microfrontends/SignDocuments/package.json
+++ b/microfrontends/SignDocuments/package.json
@@ -2,6 +2,7 @@
"name": "signmicroapp",
"version": "0.1.0",
"private": true,
+ "homepage": "./mfbuild",
"dependencies": {
"@radix-ui/themes": "^1.1.2",
"@react-pdf/renderer": "^3.1.9",
@@ -35,7 +36,7 @@
},
"scripts": {
"start": "mf-cra start",
- "build": "CI=false && BUILD_PATH='./mfbuild' mf-cra build && mv mfbuild ../../apps/OpenSign/public",
+ "build": "CI=false && PUBLIC_URL=./mfbuild BUILD_PATH='./mfbuild' mf-cra build && mv mfbuild ../../apps/OpenSign/public",
"test": "react-scripts test",
"eject": "react-scripts eject"
},