added in oauth fo dev
This commit is contained in:
+9
-2
@@ -5,6 +5,11 @@ RELAYPATH = "dev-pedw-hc"
|
||||
SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="
|
||||
SASKEYNAME = "devpedwnspolicy"
|
||||
|
||||
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
||||
TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
||||
CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015
|
||||
CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY
|
||||
GRANT_TYPE = "client_credentials"
|
||||
|
||||
PORT= "3000"
|
||||
DEFAULT_DOMAIN = "localhost"
|
||||
@@ -31,6 +36,8 @@ I18N_DOMAIN = "cymru.local"
|
||||
|
||||
|
||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
SHOWLOGIN = "false"
|
||||
SHOWLOGIN = "true"
|
||||
SHOWREPRESENTATIONS = "false"
|
||||
BASIC_AUTH_CREDENTIALS,,= pinswg:password|pinswg2:password2
|
||||
BASIC_AUTH_CREDENTIALS,,= pinswg:password|pinswg2:password2
|
||||
|
||||
NEXT_PUBLIC_ISHARESECRETPHRASE = "Secret phrase"
|
||||
+66
-57
@@ -2,10 +2,6 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
|
||||
//import {XMLHttpRequest} from 'xmlhttprequest';
|
||||
|
||||
//process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
|
||||
|
||||
let BASE_URL;
|
||||
const port = parseInt(process.env.PORT, 10) || 3000;
|
||||
|
||||
@@ -15,8 +11,12 @@ if (process.browser) {
|
||||
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
|
||||
}
|
||||
|
||||
const cache = {};
|
||||
const API_PATH = "/api/data/v8.2/";
|
||||
|
||||
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
|
||||
const tenantId = process.env.TENANT;
|
||||
|
||||
//const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -27,6 +27,48 @@ const agent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
});
|
||||
|
||||
export const getToken = () => {
|
||||
if (cache.tokenResponse) {
|
||||
console.log("from cache", tokenResponse);
|
||||
return cache.tokenResponse;
|
||||
} else {
|
||||
return axios
|
||||
.post(
|
||||
`${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`,
|
||||
tokenBody,
|
||||
tokenConfig
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.then((data) => {
|
||||
cache.tokenResponse = data;
|
||||
return data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("error :", error.response);
|
||||
// return error;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const tokenBody =
|
||||
"grant_type=" +
|
||||
process.env.GRANT_TYPE +
|
||||
"&client_id=" +
|
||||
process.env.CLIENT_ID +
|
||||
"&client_secret=" +
|
||||
process.env.CLIENT_SECRET +
|
||||
"&scope=" +
|
||||
"https://" +
|
||||
process.env.RELAYURI +
|
||||
"/.default";
|
||||
|
||||
const tokenConfig = {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Cache-Control": "no-cache",
|
||||
},
|
||||
};
|
||||
|
||||
export const getSASToken = () => {
|
||||
var m_ResourceURI =
|
||||
process.env.RELAYURI || "dev-pedw-ns.servicebus.windows.net";
|
||||
@@ -76,34 +118,6 @@ export const getSASToken = () => {
|
||||
return token;
|
||||
};
|
||||
|
||||
const accessToken =
|
||||
"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSIsImtpZCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSJ9.eyJhdWQiOiJodHRwczovL2RldmNybTIwMTYubGxjZHQuZ292LndhbGVzLyIsImlzcyI6Imh0dHA6Ly9mcy50ZXN0Lmdvdi53YWxlcy9hZGZzL3NlcnZpY2VzL3RydXN0IiwiaWF0IjoxNjMyMTIxMjkxLCJuYmYiOjE2MzIxMjEyOTEsImV4cCI6MTYzMjE1MDA5MSwidXBuIjpbIlJvYmVydC5Cb25kQHRlc3QuZ292LndhbGVzIiwicm9iZXJ0LmJvbmRAdGVzdC5nb3Yud2FsZXMiXSwicHJpbWFyeXNpZCI6IlMtMS01LTIxLTE4MDA4NDIwNzYtMjQ1NTYwNjU5LTQyMTU3NzU0NjktMTY2MjgiLCJ1bmlxdWVfbmFtZSI6IlhNXFxCb25kUiIsImFwcHR5cGUiOiJQdWJsaWMiLCJhcHBpZCI6IjQyN2ZhNzljLWI1ZmMtNDJhZC04M2Q0LTQxMGIwMzk0OGFiNiIsImF1dGhtZXRob2QiOiJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvYXV0aGVudGljYXRpb25tZXRob2Qvd2luZG93cyIsImF1dGhfdGltZSI6IjIwMjEtMDktMjBUMDc6MDE6MzEuNDYzWiIsInZlciI6IjEuMCJ9.W0ID2nCBYVxh8T1eQqWKk2Wh45kRbRzCICfzrZNAs-4u54yl0UJUcVihyI8EBmQeALCEc5eY99DjK0gaqzCdJqxbxol8yk5LrFvhV5UkCiZ7SO2Wq1cLReWHVsgz39qBtrZ8vlqqZsv7DsEaRJQbtj8Djnx26Wb_kcNu-tuXwUBF0uR5GLFFvJfM3PzkRCY-ZPOTbvPTb73oN_NKe6BrsVjyaR9xSXsRJjgHPmJgWgnvq-2X0Dj7LCwXSEygDDOGlF1yqqN0Lv6qplhQoH-heZlC1K6qe_92nHPswXag6uN5nxTmk1Qw6zJt_aHMnXdwa18ghh4hGx5R0Jz53X113Q";
|
||||
|
||||
//const SASToken = getSASToken();
|
||||
|
||||
const crmHeaders = {
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Authorization": "Bearer " + accessToken,
|
||||
},
|
||||
};
|
||||
|
||||
const crmHeadersReturn = {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": "return=representation",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + accessToken,
|
||||
},
|
||||
};
|
||||
|
||||
const azureHeaders = (SASToken) => {
|
||||
return {
|
||||
headers: {
|
||||
@@ -112,7 +126,7 @@ const azureHeaders = (SASToken) => {
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": SASToken,
|
||||
"Authorization": "Bearer " + SASToken,
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -126,7 +140,7 @@ const azureHeadersPaged = (SASToken) => {
|
||||
"Prefer":
|
||||
'odata.include-annotations="*",return=representation, odata.maxpagesize=10',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": SASToken,
|
||||
"Authorization": "Bearer " + SASToken,
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -160,7 +174,7 @@ export const getBasicSearch = (token, searchString) => {
|
||||
|
||||
export const getBasicSearchPaged = (searchString, pageNumber) => {
|
||||
//console.log("\n\n", token, searchString);
|
||||
var token = getSASToken();
|
||||
var token = getToken();
|
||||
|
||||
console.log(typeof pageNumber != "undefined");
|
||||
return axios
|
||||
@@ -204,7 +218,7 @@ export const getBasicDNSSearch = (token, searchString) => {
|
||||
};
|
||||
|
||||
export const getBasicDNSSearchPaged = (pageNumber) => {
|
||||
var token = getSASToken();
|
||||
var token = getToken();
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -274,7 +288,7 @@ export const getAdvancedSearch = (token, searchString) => {
|
||||
|
||||
export const getAdvancedSearchPaged = (searchString, pageNumber) => {
|
||||
//console.log(searchString);
|
||||
var token = getSASToken();
|
||||
var token = getToken();
|
||||
|
||||
var queryString = "";
|
||||
|
||||
@@ -358,7 +372,7 @@ export const getBasicSearchDetailsPaged = (
|
||||
incidentID
|
||||
) => {
|
||||
//console.log("check appealtype:", appealType, caseReference);
|
||||
var token = getSASToken();
|
||||
var token = getToken();
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -378,7 +392,6 @@ export const getBasicSearchDetailsPaged = (
|
||||
};
|
||||
|
||||
export const getSearchDocumentDetails = (token, incidentID) => {
|
||||
console.log(incidentID);
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
@@ -409,7 +422,7 @@ export const getSearchDocumentHistory = (token, documentID) => {
|
||||
|
||||
export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => {
|
||||
console.log(incidentID);
|
||||
var token = getSASToken();
|
||||
var token = getToken();
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -429,7 +442,7 @@ export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => {
|
||||
};
|
||||
|
||||
export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
|
||||
var token = getSASToken();
|
||||
var token = getToken();
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -449,7 +462,6 @@ export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
|
||||
|
||||
export const getSearchDocumentDetails1 = (incidentID) => {
|
||||
//console.log(incidentID);
|
||||
var token = getSASToken();
|
||||
return axios
|
||||
.get(
|
||||
"/api/proxy/pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
@@ -464,7 +476,6 @@ export const getSearchDocumentDetails1 = (incidentID) => {
|
||||
|
||||
export const getSearchDocumentDetails1Paged = (incidentID, pageNumber) => {
|
||||
//console.log(incidentID);
|
||||
var token = getSASToken();
|
||||
return axios
|
||||
.get(
|
||||
"/api/proxy/pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
@@ -483,7 +494,6 @@ export const getSearchDocumentDetails1Paged = (incidentID, pageNumber) => {
|
||||
|
||||
export const getSearchDocumentHistory1 = (documentID) => {
|
||||
//console.log(documentID);
|
||||
var token = getSASToken();
|
||||
return axios
|
||||
.get(
|
||||
"/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
|
||||
@@ -499,7 +509,6 @@ export const getSearchDocumentHistory1 = (documentID) => {
|
||||
|
||||
export const getSearchDocumentHistory1Paged = (documentID, pageNumber) => {
|
||||
//console.log(documentID);
|
||||
var token = getSASToken();
|
||||
return axios
|
||||
.get(
|
||||
"/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
|
||||
@@ -533,7 +542,7 @@ export const getBasicDNSSearchDetails = (token, appealType, caseReference) => {
|
||||
};
|
||||
|
||||
export const getBasicDNSSearchDetailsPaged = (caseReference) => {
|
||||
var token = getSASToken();
|
||||
var token = getToken();
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -550,7 +559,7 @@ export const getBasicDNSSearchDetailsPaged = (caseReference) => {
|
||||
|
||||
export const getLinkedCases = (parentIncidentid) => {
|
||||
//console.log(parentIncidentid);
|
||||
var token = getSASToken();
|
||||
//var token = getToken();
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -698,7 +707,7 @@ export const getAppealID = (
|
||||
|
||||
console.log("proxy url ", weburl);
|
||||
return axios
|
||||
.get(weburl, azureHeaders(getSASToken()))
|
||||
.get(weburl, azureHeaders(getToken()))
|
||||
.then((res) => {
|
||||
var appealID = res.data.value[0][primaryAttribute];
|
||||
return appealID;
|
||||
@@ -784,7 +793,7 @@ export const updateCase = async (
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": getSASToken(),
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
@@ -857,7 +866,7 @@ export const deleteMyRepresentations = (myRepresentationsID) => {
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": getSASToken(),
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
};
|
||||
// console.log(config);
|
||||
@@ -877,7 +886,7 @@ export const getRepresentations = (incidentID) => {
|
||||
"/api/proxy/pinswg_representationses?$filter= _pinswg_case_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc",
|
||||
azureHeaders(getSASToken())
|
||||
azureHeaders(getToken())
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
@@ -940,7 +949,7 @@ export const createWatchedCases = (formValues) => {
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": getSASToken(),
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
@@ -965,7 +974,7 @@ export const deleteWatchedCases = (watchedCaseID) => {
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": getSASToken(),
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
};
|
||||
// console.log(config);
|
||||
@@ -1027,7 +1036,7 @@ export const getPortalModuleDetailsProxy = (
|
||||
};
|
||||
|
||||
export const getEmailAccountCheck = (emailAddress) => {
|
||||
let token = getSASToken();
|
||||
let token = getToken();
|
||||
return axios
|
||||
.get(
|
||||
"/api/proxy/contacts?$filter=emailaddress1 eq '" +
|
||||
@@ -1052,7 +1061,7 @@ export const createAccount = (formValues) => {
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": getSASToken(),
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
@@ -1079,7 +1088,7 @@ export const updateAccount = (contactId, updateBody) => {
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": getSASToken(),
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
@@ -1107,7 +1116,7 @@ export const updatePassword = (contactId, newpassword) => {
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": getSASToken(),
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import PaginationControl from "./pagination";
|
||||
import LoadingOverlay from "react-loading-overlay";
|
||||
import CryptoJS from "crypto-js";
|
||||
|
||||
import {
|
||||
getBasicSearch,
|
||||
@@ -15,7 +16,7 @@ import {
|
||||
getSearchDocumentHistory1,
|
||||
getSearchDocumentHistory1Paged,
|
||||
getSearchDocumentDetails1Paged,
|
||||
getSASToken,
|
||||
getToken,
|
||||
} from "../../actions";
|
||||
|
||||
import {
|
||||
@@ -106,7 +107,9 @@ const DocumentDetails = (props) => {
|
||||
<a
|
||||
href={
|
||||
"/api/proxy/documents/download/" +
|
||||
detailsObj.pinswg_isharedocumentreference
|
||||
encryptDocReference(
|
||||
detailsObj.pinswg_isharedocumentreference
|
||||
)
|
||||
}
|
||||
>
|
||||
<span className="results-visually-hidden">
|
||||
@@ -191,6 +194,17 @@ const DocumentDetails = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const encryptDocReference = (documentRef) => {
|
||||
var encrypted = encodeURIComponent(
|
||||
CryptoJS.AES.encrypt(
|
||||
documentRef,
|
||||
process.env.NEXT_PUBLIC_ISHARESECRETPHRASE
|
||||
)
|
||||
);
|
||||
|
||||
return encrypted;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const docDetailsObj = async () => {
|
||||
let docObj = await getSearchDocumentDetails1(incidentid)
|
||||
|
||||
@@ -129,7 +129,7 @@ let Login = (props) => {
|
||||
let now = new Date();
|
||||
let expDate = new Date(now);
|
||||
|
||||
expDate.setDate(now.getDate() + 0.41);
|
||||
expDate.setDate(now.getDate() + 1);
|
||||
|
||||
getLogin(values.loginUserID, values.loginUserPassword).then((data) => {
|
||||
data.value.length != 0
|
||||
|
||||
@@ -6,7 +6,7 @@ import { setCurrentReference } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import { parseCookies } from "nookies";
|
||||
import {
|
||||
getSASToken,
|
||||
getToken,
|
||||
getWatchedCasesProxy,
|
||||
getPortalModuleDetailsProxy,
|
||||
deleteWatchedCases,
|
||||
@@ -37,7 +37,7 @@ const TopThree = (props) => {
|
||||
let showTopThreeArr = showTopThree.value;
|
||||
|
||||
const deleteItem = (caseID, topThreeType) => {
|
||||
let token = getSASToken();
|
||||
let token = getToken();
|
||||
let cookies = parseCookies();
|
||||
topThreeType == "watchedCases" &&
|
||||
deleteWatchedCases(caseID)
|
||||
|
||||
@@ -39,7 +39,7 @@ import {
|
||||
|
||||
import {
|
||||
createWatchedCases,
|
||||
getSASToken,
|
||||
getToken,
|
||||
getWatchedCasesProxy,
|
||||
getPortalModuleDetailsProxy,
|
||||
deleteWatchedCases,
|
||||
@@ -77,7 +77,7 @@ const SearchResults = (props) => {
|
||||
const cookies = parseCookies();
|
||||
|
||||
const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
|
||||
let token = getSASToken();
|
||||
let token = getToken();
|
||||
|
||||
let updateBody = {
|
||||
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
||||
@@ -109,7 +109,7 @@ const SearchResults = (props) => {
|
||||
};
|
||||
|
||||
const deleteItem = (caseID, topThreeType) => {
|
||||
let token = getSASToken();
|
||||
let token = getToken();
|
||||
let cookies = parseCookies();
|
||||
topThreeType == "watchedCases" &&
|
||||
deleteWatchedCases(caseID)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"axios": "^0.21.1",
|
||||
"compression": "^1.7.4",
|
||||
"cookie-cutter": "^0.2.0",
|
||||
"cookies": "^0.8.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"date-fns": "^2.25.0",
|
||||
"dom": "^0.0.3",
|
||||
|
||||
@@ -13,6 +13,8 @@ class MyDocument extends Document {
|
||||
let hasBasicAuth =
|
||||
typeof process.env.BASIC_AUTH_CREDENTIALS != "undefined";
|
||||
|
||||
console.log(hasBasicAuth);
|
||||
|
||||
if (ctx.req && ctx.res) {
|
||||
hasBasicAuth &&
|
||||
(await basicAuthMiddleware(ctx.req, ctx.res, {
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
getLPA,
|
||||
updateCase,
|
||||
createCase,
|
||||
getSASToken,
|
||||
getToken,
|
||||
} from "../actions";
|
||||
import { setLPA } from "../store/lpa/action";
|
||||
|
||||
@@ -139,7 +139,8 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
const token = await getSASToken();
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const [appealTypeData, lpaData] = await Promise.all([
|
||||
await getAppealsTypes(token),
|
||||
|
||||
@@ -22,11 +22,7 @@ import {
|
||||
setSearchDetails,
|
||||
getSearchResultsObj,
|
||||
} from "../store/searchOutput/action";
|
||||
import {
|
||||
getAdvancedSearch,
|
||||
getBasicSearchDetails,
|
||||
getSASToken,
|
||||
} from "../actions";
|
||||
import { getAdvancedSearch, getBasicSearchDetails, getToken } from "../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -127,7 +123,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("query-", query);
|
||||
//console.log("search array:", Object.entries(query));
|
||||
|
||||
const token = await getSASToken();
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const searchResultsObj = await getAdvancedSearch(token, query);
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { response } from "express";
|
||||
import HmacSHA256 from "crypto-js/hmac-sha256";
|
||||
|
||||
const PROXY_RELAY_URL =
|
||||
"https://" +
|
||||
|
||||
@@ -24,11 +24,7 @@ import {
|
||||
setSearchDetails,
|
||||
getSearchResultsObj,
|
||||
} from "../store/searchOutput/action";
|
||||
import {
|
||||
getBasicDNSSearch,
|
||||
getBasicSearchDetails,
|
||||
getSASToken,
|
||||
} from "../actions";
|
||||
import { getBasicDNSSearch, getBasicSearchDetails, getToken } from "../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -127,7 +123,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
async ({ query, req, res }) => {
|
||||
console.log("query-", query);
|
||||
|
||||
const token = await getSASToken();
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
let searchResultsObj = await getBasicDNSSearch(token);
|
||||
searchResultsObj =
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
getLPA,
|
||||
updateCase,
|
||||
createCase,
|
||||
getSASToken,
|
||||
getToken,
|
||||
} from "../../actions";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
|
||||
@@ -77,7 +77,8 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
const token = await getSASToken();
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const [appealTypeData, lpaData] = await Promise.all([
|
||||
await getAppealsTypes(token),
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { getAdvancedSearch, getSASToken } from "../../actions";
|
||||
import { getAdvancedSearch, getToken } from "../../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -62,7 +62,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("query-", query);
|
||||
//console.log("search array:", Object.entries(query));
|
||||
|
||||
const token = await getSASToken();
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const searchResultsObj = await getAdvancedSearch(token, query);
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
setAwaitingSubmissionDetails,
|
||||
} from "../../store/awaitingSubmission/action";
|
||||
import {
|
||||
getSASToken,
|
||||
getToken,
|
||||
getPersonalAccount,
|
||||
getMyCases,
|
||||
getMyRepresentations,
|
||||
@@ -152,7 +152,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
const { cookies } = req;
|
||||
|
||||
const token = await getSASToken();
|
||||
console.log("the cookoies", cookies);
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
@@ -171,6 +174,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
]);
|
||||
|
||||
//const cookiesMaker = nookies.get(ctx)
|
||||
console.log(accountDetails);
|
||||
const [
|
||||
myCasesDetails,
|
||||
myRepresentationsDetails,
|
||||
@@ -199,7 +203,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
);
|
||||
|
||||
const getDetails = (token, resultsObj, detailsType) => {
|
||||
//console.log(resultsObj);
|
||||
console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||
|
||||
@@ -39,7 +39,7 @@ import {
|
||||
getSearchDocumentHistory,
|
||||
getWatchedCases,
|
||||
getPortalModuleDetails,
|
||||
getSASToken,
|
||||
getToken,
|
||||
} from "../../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
@@ -82,7 +82,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
const { cookies } = req;
|
||||
|
||||
const token = await getSASToken();
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
} from "../../store/appealType/action";
|
||||
import { setForm, getFormObj } from "../../store/formData/action";
|
||||
import {
|
||||
getSASToken,
|
||||
getToken,
|
||||
getFormData,
|
||||
getAppealsTypes,
|
||||
getMandatoryFields,
|
||||
@@ -331,7 +331,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("the query", query);
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
const token = await getSASToken();
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
const [
|
||||
caseReferenceData,
|
||||
appealTypeData,
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
getLPA,
|
||||
updateCase,
|
||||
createCase,
|
||||
getSASToken,
|
||||
getToken,
|
||||
} from "../../actions";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
|
||||
@@ -150,7 +150,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
const token = await getSASToken();
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const [appealTypeData, lpaData, caseData] = await Promise.all([
|
||||
await getAppealsTypes(token),
|
||||
|
||||
@@ -42,7 +42,8 @@ const Home = (props) => {
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// async ({ locale, store, req, res }) => {
|
||||
// const token = await getToken();
|
||||
// let token = await getToken()
|
||||
token = token.access_token;
|
||||
// let accessToken = token.access_token;
|
||||
|
||||
// const apiRoot = process.browser ? window.API_ROOT : process.env.API_ROOT;
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
setSearchDetails,
|
||||
getSearchResultsObj,
|
||||
} from "../store/searchOutput/action";
|
||||
import { getBasicSearch, getBasicSearchDetails, getSASToken } from "../actions";
|
||||
import { getBasicSearch, getBasicSearchDetails, getToken } from "../actions";
|
||||
import { getSearchDetails } from "../components/utils";
|
||||
|
||||
const Home = (props) => {
|
||||
@@ -121,7 +121,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
async ({ query, req, res }) => {
|
||||
console.log("query-", query);
|
||||
|
||||
const token = await getSASToken();
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
let searchResultsObj = await getBasicSearch(token, query.q);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user