small refactor
This commit is contained in:
parent
c77c8e12a2
commit
5eedfb9ce6
1 changed files with 5 additions and 8 deletions
|
|
@ -2,6 +2,7 @@ import { storeActions } from "@/constants/store-actions.js";
|
|||
import { cookieNames } from "@/constants/cookie-names";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import { applicationConfig } from "@/constants/application-config";
|
||||
|
||||
import store from "@/store";
|
||||
import router from "@/router";
|
||||
import baseMixin from "../mixins/base-mixin";
|
||||
|
|
@ -27,7 +28,7 @@ export async function saveOrder() {
|
|||
export async function loadOrder(referralNumber, referralDate, correlationId) {
|
||||
console.log("loading order...", referralNumber, referralDate, correlationId);
|
||||
await baseMixin.methods.dispatchNonBlockingStoreAction(storeActions.LOAD_ORDER,
|
||||
{ referralNumber: referralNumber, referralDate: referralDate, correlationId: correlationId }
|
||||
{ referralNumber: referralNumber.toString(), referralDate: referralDate, correlationId: correlationId }
|
||||
, false);
|
||||
}
|
||||
|
||||
|
|
@ -50,14 +51,14 @@ export async function loadReferralIfPresent() {
|
|||
return;
|
||||
}
|
||||
|
||||
console.log("Loading order...");
|
||||
console.log("calling load order from loadReferralIfPresent()...");
|
||||
// Load referral if there is a cookie, and it doesn't indicate it needs a state reset.
|
||||
await loadOrder(conceptCookie.ReferralNumber, conceptCookie.ReferralDate, conceptCookie.ReferralCorrelationId);
|
||||
}
|
||||
|
||||
export function updateOrCreateConceptCookie() {
|
||||
console.log("Updating cookie...", {
|
||||
LastTouched: new Date(),
|
||||
LastTouched: new Date().toUTCString(),
|
||||
DidHeritageFunnelUpdateLast: false,
|
||||
ShouldResetState: false,
|
||||
ReferralNumber: store.state.order.referralNumber,
|
||||
|
|
@ -70,7 +71,7 @@ export function updateOrCreateConceptCookie() {
|
|||
|
||||
// Set up cookie with all the props.
|
||||
setConceptCookieProperties({
|
||||
LastTouched: new Date(),
|
||||
LastTouched: new Date().toUTCString(),
|
||||
DidHeritageFunnelUpdateLast: false,
|
||||
ShouldResetState: false,
|
||||
ReferralNumber: store.state.order.referralNumber,
|
||||
|
|
@ -85,7 +86,6 @@ export function isConceptSessionStillActive() {
|
|||
const lastTouchedValue = getConceptCookie().LastTouched;
|
||||
const timeoutAmount = applicationConfig.SESSION_TIMEOUT_CONFIG;
|
||||
const isMoreThanHalfHourAgo = ((new Date() - new Date(lastTouchedValue)) / 60000) > timeoutAmount;
|
||||
|
||||
console.log("has session expired -->", isMoreThanHalfHourAgo);
|
||||
|
||||
if (isMoreThanHalfHourAgo) {
|
||||
|
|
@ -129,9 +129,6 @@ export function getConceptCookie() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// --------- PRIVATE FUNCTIONS ---------
|
||||
|
||||
function setConceptCookieProperties(properties) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue