49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
// lib/newappeal/hydrateNewAppealStore.js
|
|
import {
|
|
setContainerID,
|
|
setLoggedInUserEmail,
|
|
setLoggedInUserId,
|
|
setAccountDetails,
|
|
} from "../../store/accountDetails/action";
|
|
import {
|
|
setAppealLPA,
|
|
setAppealType,
|
|
setAppealTypeID,
|
|
// IMPORTANT: avoid name collision in your page by importing as Action
|
|
setCaseReference as setCaseReferenceAction,
|
|
} from "../../store/appealType/action";
|
|
import { setForm } from "../../store/formData/action";
|
|
|
|
/**
|
|
* Dispatches all actions needed to hydrate Redux store for the page.
|
|
*/
|
|
export function hydrateNewAppealStore(store, query, data) {
|
|
const {
|
|
session,
|
|
loggedInUser,
|
|
loggedInUserEmail,
|
|
appealTypeData,
|
|
mandatoryFieldsData,
|
|
pickListData,
|
|
blobProgress,
|
|
accountDetails,
|
|
xmlStr,
|
|
} = data;
|
|
|
|
const caseReference = {
|
|
ticketnumber: query.id,
|
|
incidentid: query.id,
|
|
caseDetails: blobProgress,
|
|
};
|
|
|
|
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));
|
|
}
|