83 lines
2.4 KiB
JavaScript
83 lines
2.4 KiB
JavaScript
// lib/myportal/hydrateMyPortalAppealStore.js
|
|
import {
|
|
setContainerID,
|
|
setLoggedInUserEmail,
|
|
setLoggedInUserId,
|
|
setAccountDetails,
|
|
} from "../../store/accountDetails/action";
|
|
|
|
import {
|
|
setAppealLPA,
|
|
setAppealType,
|
|
setAppealTypeID,
|
|
setCaseReference as setCaseReferenceAction,
|
|
setFilesForAppeal,
|
|
} from "../../store/appealType/action";
|
|
|
|
import {
|
|
setAwaitingSubmissionDetails,
|
|
setAwaitingSubmissionFromBlob,
|
|
} from "../../store/awaitingSubmission/action";
|
|
|
|
import { setCurrentView, setLocale } from "../../store/currentView/action";
|
|
import { setForm } from "../../store/formData/action";
|
|
|
|
/**
|
|
* Hydrates Redux store for resume flow in /myportal/[appealtypes]
|
|
*/
|
|
export function hydrateMyPortalAppealStore(store, ctx, data) {
|
|
const { query, locale } = ctx;
|
|
|
|
const {
|
|
session,
|
|
loggedInUser,
|
|
loggedInUserEmail,
|
|
appealTypeData,
|
|
mandatoryFieldsData,
|
|
pickListData,
|
|
blobList,
|
|
blobProgress,
|
|
accountDetails,
|
|
awaitingSubmissionFromBlob,
|
|
xmlStr,
|
|
} = data;
|
|
|
|
// Keep existing behaviour: write locale into store
|
|
store.dispatch(setLocale(locale));
|
|
|
|
// Build caseReference in the same shape you already use
|
|
const caseReference = {
|
|
ticketnumber: query.casereference,
|
|
incidentid: query.inid, // as per your file
|
|
caseDetails: blobProgress,
|
|
};
|
|
|
|
// Optional awaiting submission state setup
|
|
if (awaitingSubmissionFromBlob) {
|
|
store.dispatch(
|
|
setAwaitingSubmissionFromBlob(awaitingSubmissionFromBlob)
|
|
);
|
|
store.dispatch(
|
|
setAwaitingSubmissionDetails(awaitingSubmissionFromBlob)
|
|
);
|
|
store.dispatch(
|
|
setCurrentView({
|
|
viewName: "Awaiting Submission",
|
|
viewKey: "awaitingSubmissionDetails",
|
|
})
|
|
);
|
|
}
|
|
|
|
store.dispatch(setLoggedInUserId(loggedInUser));
|
|
store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
|
|
store.dispatch(setAppealLPA(query.lpa));
|
|
store.dispatch(setAppealTypeID(query.apt));
|
|
store.dispatch(setCaseReferenceAction(caseReference));
|
|
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
|
store.dispatch(setAppealType(appealTypeData));
|
|
store.dispatch(setContainerID(session.user.id));
|
|
store.dispatch(setAccountDetails(accountDetails));
|
|
|
|
store.dispatch(setFilesForAppeal(blobList));
|
|
}
|