Removed proxy and added api calls, has gov gateway auth
This commit is contained in:
@@ -6,7 +6,6 @@ import { setCurrentReference } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import { parseCookies } from "nookies";
|
||||
import {
|
||||
getToken,
|
||||
getWatchedCasesProxy,
|
||||
getPortalModuleDetailsProxy,
|
||||
deleteWatchedCases,
|
||||
@@ -37,26 +36,21 @@ const TopThree = (props) => {
|
||||
let showTopThreeArr = showTopThree.value;
|
||||
|
||||
const deleteItem = (caseID, topThreeType) => {
|
||||
let token = getToken();
|
||||
let cookies = parseCookies();
|
||||
topThreeType == "watchedCases" &&
|
||||
deleteWatchedCases(caseID)
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(token, cookies.pinsUser).then(
|
||||
(data) => {
|
||||
setWatchedCases(data),
|
||||
getDetails(token, data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
setWatchedCases(data),
|
||||
getDetails(data, "myWatchedCases").then((data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const getDetails = (token, resultsObj, detailsType) => {
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
//console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
@@ -72,7 +66,6 @@ const TopThree = (props) => {
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuleDetailsProxy(
|
||||
token,
|
||||
getFormCollectionByID(
|
||||
searchDetail.pinswg_appealcasetype
|
||||
).LogicalCollectionName,
|
||||
@@ -89,6 +82,24 @@ const TopThree = (props) => {
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const getIncidentId = (topThreeType, objArr) => {
|
||||
switch (topThreeType) {
|
||||
case "myCases":
|
||||
return objArr.incidentid;
|
||||
break;
|
||||
case "watchedCases":
|
||||
return objArr._pinswg_watchedcase_value;
|
||||
break;
|
||||
case "myRepresentations":
|
||||
return objArr.ticketnumber;
|
||||
break;
|
||||
case "awaitingSubmission":
|
||||
break;
|
||||
default:
|
||||
// code block
|
||||
}
|
||||
};
|
||||
|
||||
let topThreeOnlyArr = showTopThreeArr.slice(0, 3);
|
||||
Object.keys(topThreeOnlyArr).map((key, index) => {
|
||||
topthreeRow.push(
|
||||
@@ -126,18 +137,10 @@ const TopThree = (props) => {
|
||||
],
|
||||
"currentType": topThreeType,
|
||||
|
||||
"incidentid":
|
||||
topThreeType != "watchedCases"
|
||||
? topThreeType !=
|
||||
"myRepresentations"
|
||||
? showTopThreeArr[key]
|
||||
._pinswg_case_value
|
||||
: showTopThreeArr[key][
|
||||
" _pinswg_watchedcase_value"
|
||||
]
|
||||
: showTopThreeArr[key][
|
||||
" _pinswg_watchedcase_value"
|
||||
],
|
||||
"incidentid": getIncidentId(
|
||||
topThreeType,
|
||||
showTopThreeArr[key]
|
||||
),
|
||||
|
||||
"appealType":
|
||||
showTopThreeArr[key]
|
||||
|
||||
Reference in New Issue
Block a user