diff --git a/components/myportal.js b/components/myportal.js index 495bb19d..6a15097b 100644 --- a/components/myportal.js +++ b/components/myportal.js @@ -168,6 +168,7 @@ const MyPortal = (props) => { watchedCases={props.watchedCases} isLPA={isLPA} myReps={false} + accountDetails={props.accountDetails} /> )} {props.myRepresentations.hasOwnProperty( diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index 2617bb34..f9c2dbb8 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -114,13 +114,32 @@ const TopThree = (props) => { deleteWatchedCases(caseID) .then((data) => data) .then(() => { - getWatchedCasesProxy(cookies.pinsUser).then((data) => { - setWatchedCases(data), - getDetailsProxy(data, "myWatchedCases").then( - (data) => { - setWatchedCasesDetails(data); - } - ); + getWatchedCasesProxy( + props.accountDetails.loggedinUserId + ).then((data) => { + let showWatchedCases = (submittedArr) => { + const required = submittedArr.value.filter((el) => { + return ( + el.pinswg_representationsubmitted == null + ); + }); + + let newObj = {}; + return Object.assign(newObj, { + "@odata.count": required.length, + "value": required, + }); + }; + + let filteredWatchedCases = showWatchedCases(data); + + setWatchedCases(filteredWatchedCases), + getDetailsProxy( + filteredWatchedCases, + "myWatchedCases" + ).then((data) => { + setWatchedCasesDetails(data); + }); }); }); diff --git a/components/myportal/watchedcases.js b/components/myportal/watchedcases.js index c48a14f4..40a328c2 100644 --- a/components/myportal/watchedcases.js +++ b/components/myportal/watchedcases.js @@ -31,6 +31,7 @@ const WatchedCases = (props) => { currentView={props.currentView} myReps={props.myReps} props={props} + accountDetails={props.accountDetails} />