added create contact flow for registration

This commit is contained in:
2021-10-13 07:40:36 +01:00
parent 7238a79895
commit b34c56145d
22 changed files with 663 additions and 307 deletions
+50 -45
View File
@@ -82,58 +82,63 @@ const Home = (props) => {
};
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
//console.log("the query", query);
(store) => async (ctx) => {
const { query, req, res } = ctx;
console.log("the query", query);
const token = await getSASToken();
const { cookies } = req;
const [
myCases,
myRepresentations,
watchedCases,
awaitingSubmission,
] = await Promise.all([
await getMyCases(token, "f8b454ed-eded-eb11-aac7-00224800be9c"),
await getMyRepresentations(token),
await getWatchedCases(token),
console.log(cookies);
const token = await getSASToken();
let loggedInUser =
typeof query.q == undefined ? cookies.pinsUser : query.q;
console.log("qweqe ", loggedInUser);
const [myCases, myRepresentations, watchedCases, awaitingSubmission] =
await Promise.all([
await getMyCases(token, loggedInUser),
await getMyRepresentations(token, loggedInUser),
await getWatchedCases(token, loggedInUser),
await getAwaitingSubmission(token),
]);
const cookies = new Cookies(req, res);
const cookiesMaker = new Cookies(req, res);
cookies.set("pinsUser", "f8b454ed-eded-eb11-aac7-00224800be9c", {
httpOnly: true, // true by default
});
//console.log("my cases ", myCases);
const [
myCasesDetails,
// myRepresentationsDetails,
// watchedCasesDetails,
// awaitingSubmissionDetails,
] = await Promise.all([
await getDetails(token, myCases),
// await getDetails(myRepresentations),
// await getDetails(watchedCases),
// await getDetails(awaitingSubmission),
]);
cookiesMaker.set("pinsUser", query.q, {
httpOnly: true, // true by default
});
store.dispatch(
setLoggedInUserId("f8b454ed-eded-eb11-aac7-00224800be9c")
);
store.dispatch(setMyCases(myCases));
store.dispatch(setMyCasesDetails(myCasesDetails));
store.dispatch(setMyRepresentations(myRepresentations));
// store.dispatch(
// setMyRepresentationsDetails(myRepresentationsDetails)
// );
store.dispatch(setWatchedCases(watchedCases));
//store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setAwaitingSubmission(awaitingSubmission));
// store.dispatch(
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
// );
}
console.log(" from cookie ", cookiesMaker.get("pinsUser"));
console.log(myCases);
const [
myCasesDetails,
myRepresentationsDetails,
watchedCasesDetails,
// awaitingSubmissionDetails,
] = await Promise.all([
await getDetails(token, myCases),
await getDetails(token, myRepresentations),
await getDetails(token, watchedCases),
// await getDetails(awaitingSubmission),
]);
console.log(myCasesDetails);
store.dispatch(setLoggedInUserId(loggedInUser));
store.dispatch(setMyCases(myCases));
store.dispatch(setMyCasesDetails(myCasesDetails));
store.dispatch(setMyRepresentations(myRepresentations));
store.dispatch(setMyRepresentationsDetails(myRepresentationsDetails));
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setAwaitingSubmission(awaitingSubmission));
// store.dispatch(
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
// );
}
);
const getFormCollection = (formtype) => {
+45 -9
View File
@@ -20,9 +20,17 @@ import { setSearch, getSearchObj } from "../../store/search/action";
import {
setSearchResults,
setSearchDetails,
setDocumentDetails,
setDocumentHistory,
getSearchResultsObj,
} from "../../store/searchOutput/action";
import { getBasicSearch, getBasicSearchDetails } from "../../actions";
import {
getBasicSearch,
getBasicSearchDetails,
getSearchDocumentDetails,
getSearchDocumentHistory,
getSASToken,
} from "../../actions";
const Home = (props) => {
const { footerLinks, pages } = props;
@@ -47,6 +55,7 @@ const Home = (props) => {
<SearchResults
searchString={props.search.searchString}
searchResultsObj={props.searchResultsObj}
myportal="true"
/>
</div>
<Footer footerLinks={footerLinks} />
@@ -59,14 +68,38 @@ export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
console.log("query-", query);
// const [searchResultsObj, searchDetailsObj] = await Promise.all(
// await getBasicSearch(query.q),
// await getBasicSearchDetails(query.d)
const token = await getSASToken();
let searchResultsObj = await getBasicSearch(token, query.q);
searchResultsObj =
searchResultsObj.status == 502
? {
value: [],
errorCode: searchResultsObj.status,
errorMsg: searchResultsObj.statusText,
}
: searchResultsObj;
//console.log("sssss", searchResultsObj);
const searchDetailsObj = await getSearchDetails(
token,
searchResultsObj
);
// const searchDocumentResultsObj = await getDocumentDetails(
// token,
// searchResultsObj
// );
const searchResultsObj = await getBasicSearch(query.q);
const searchDetailsObj = await getSearchDetails(searchResultsObj);
// console.log(searchDetailsObj);
// const searchDocumentHistoryObj = await getDocumentHistory(
// token,
// searchDocumentResultsObj
// );
// console.log(searchDocumentHistoryObj);
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setSearch(query.q));
@@ -82,7 +115,7 @@ const getFormCollection = (formtype) => {
return collectionName[0];
};
const getSearchDetails = (searchResultsObj) => {
const getSearchDetails = (token, searchResultsObj) => {
//console.log(searchResultsObj);
let detailsArr = [];
@@ -93,13 +126,15 @@ const getSearchDetails = (searchResultsObj) => {
} else {
detailsArr.push(
getBasicSearchDetails(
token,
getFormCollection(
"pinswg_" +
searchDetail[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
]
.replace(/[\s\-\+\(\)\,\&\.]/g, "")
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
.slice(0, 39)
),
searchDetail.ticketnumber
)
@@ -122,6 +157,7 @@ const mapStateToProps = (state) => {
watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission,
accountDetails: state.accountDetails,
};
};