watched case and stop wathcing case added

This commit is contained in:
2021-11-04 12:03:01 +00:00
parent 3283b92138
commit 449b089aba
23 changed files with 675 additions and 179 deletions
+16 -30
View File
@@ -154,11 +154,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
const token = await getSASToken();
console.log("does it have ", cookies.pinsUser);
let loggedInUser = cookies.pinsUser;
console.log("qweqe ", loggedInUser);
const [
accountDetails,
myCases,
@@ -174,36 +171,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
]);
//const cookiesMaker = nookies.get(ctx)
let now = new Date();
let expDate = new Date(now);
expDate.setDate(now.getDate() + 1);
console.log(
"Check: ",
cookies,
cookies.pinsUser,
loggedInUser,
nookies.get("pinsUser")
);
// nookies.set(ctx, "pinsUser", loggedInUser, {
// expires: expDate,
// httpOnly: false,
// path: "/",
// });
console.log(" from cookie ", cookies);
const [
myCasesDetails,
myRepresentationsDetails,
watchedCasesDetails,
// awaitingSubmissionDetails,
] = await Promise.all([
await getDetails(token, myCases),
await getDetails(token, myRepresentations),
await getDetails(token, watchedCases),
await getDetails(token, myCases, "myCases"),
await getDetails(token, myRepresentations, "myRepresentations"),
await getDetails(token, watchedCases, "myWatchedCases"),
// await getDetails(awaitingSubmission),
]);
@@ -222,20 +198,30 @@ export const getServerSideProps = wrapper.getServerSideProps(
}
);
const getDetails = (token, resultsObj) => {
const getDetails = (token, resultsObj, detailsType) => {
//console.log(resultsObj);
let detailsArr = [];
resultsObj = resultsObj.value;
const detailsObj = resultsObj.map((searchDetail, index) => {
if (searchDetail.pinswg_appealcasetype == null) {
console.log(searchDetail.ticketnumber);
console.log(
detailsType != "myWatchedCases"
? searchDetail.ticketnumber
: searchDetail[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]
);
} else {
detailsArr.push(
getPortalModuleDetails(
token,
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
.LogicalCollectionName,
searchDetail.ticketnumber
detailsType != "myWatchedCases"
? searchDetail.ticketnumber
: searchDetail[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]
)
);
}