Merge pull request #3149 from Safelite/nation/CASH-1545
CASH-1545 check session expiration with JS interval
This commit is contained in:
commit
b8e336c8a3
4 changed files with 25 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ const environmentVariables = {
|
||||||
['__VUE_APP_SOLARWINDS_MONITORING_SCRIPT__']: "",
|
['__VUE_APP_SOLARWINDS_MONITORING_SCRIPT__']: "",
|
||||||
['__VUE_APP_ADYEN_ENVIRONMENT__']: "test",
|
['__VUE_APP_ADYEN_ENVIRONMENT__']: "test",
|
||||||
['__VUE_APP_ADYEN_CLIENT_KEY__']: "test_WYGT4F5ZT5BRRL5MPWHK6QLYOIXZXROD",
|
['__VUE_APP_ADYEN_CLIENT_KEY__']: "test_WYGT4F5ZT5BRRL5MPWHK6QLYOIXZXROD",
|
||||||
|
['__VUE_APP_SESSION_EXPIRATION_INTERVAL_CHECK_MILLISECONDS__']: 60000,
|
||||||
};
|
};
|
||||||
|
|
||||||
const keysOnly = Object.keys(environmentVariables);
|
const keysOnly = Object.keys(environmentVariables);
|
||||||
|
|
|
||||||
22
src/App.vue
22
src/App.vue
|
|
@ -18,6 +18,8 @@ import { showFmgLoadingModal } from "@/helpers/loading-modal-helper";
|
||||||
import funnelFooter from "@/fmg-components/funnel-footer/funnel-footer.vue";
|
import funnelFooter from "@/fmg-components/funnel-footer/funnel-footer.vue";
|
||||||
import salesforceWebchat from "./digital-components/salesforce-webchat/salesforce-webchat.vue";
|
import salesforceWebchat from "./digital-components/salesforce-webchat/salesforce-webchat.vue";
|
||||||
import sierraWebchat from "./digital-components/sierra-webchat/sierra-webchat.vue";
|
import sierraWebchat from "./digital-components/sierra-webchat/sierra-webchat.vue";
|
||||||
|
import analyticsMixin from "@/mixins/analytics-mixin";
|
||||||
|
import { applicationConfig } from "@/constants/application-config";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "app",
|
name: "app",
|
||||||
|
|
@ -25,8 +27,18 @@ export default {
|
||||||
const { globalNonpersistedState } = showFmgLoadingModal();
|
const { globalNonpersistedState } = showFmgLoadingModal();
|
||||||
return { globalNonpersistedState };
|
return { globalNonpersistedState };
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
sessionCheckInterval: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleAnyComponentFocus: handleAnyComponentFocus,
|
handleAnyComponentFocus: handleAnyComponentFocus,
|
||||||
|
checkSessionAndRedirect() {
|
||||||
|
if (analyticsMixin.methods.sessionExpired()) {
|
||||||
|
this.$router.sendToReturnUser();
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
shouldShowLoader() {
|
shouldShowLoader() {
|
||||||
|
|
@ -44,6 +56,16 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
showFmgLoadingModal(true);
|
showFmgLoadingModal(true);
|
||||||
|
// Check session expiration and redirect if expired
|
||||||
|
this.sessionCheckInterval = setInterval(
|
||||||
|
this.checkSessionAndRedirect,
|
||||||
|
applicationConfig.SESSION_EXPIRATION_INTERVAL_CHECK_MILLISECONDS
|
||||||
|
);
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
if (this.sessionCheckInterval) {
|
||||||
|
clearInterval(this.sessionCheckInterval);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ const applicationConfig = {
|
||||||
AFFILIATE_COOKIE_CONTAINING_NAME: "_Track",
|
AFFILIATE_COOKIE_CONTAINING_NAME: "_Track",
|
||||||
COOKIE_NAME_LENGTH_MAX_LIMIT: 44,
|
COOKIE_NAME_LENGTH_MAX_LIMIT: 44,
|
||||||
SESSION_TIMEOUT_MINUTES: process.env.__VUE_APP_SESSION_TIMEOUT_MINUTES__,
|
SESSION_TIMEOUT_MINUTES: process.env.__VUE_APP_SESSION_TIMEOUT_MINUTES__,
|
||||||
|
SESSION_EXPIRATION_INTERVAL_CHECK_MILLISECONDS:
|
||||||
|
process.env.__VUE_APP_SESSION_EXPIRATION_INTERVAL_CHECK_MILLISECONDS__,
|
||||||
RETURN_USER_PAGE: "/fmg/return-user",
|
RETURN_USER_PAGE: "/fmg/return-user",
|
||||||
ADYEN_CLIENT_KEY: process.env.__VUE_APP_ADYEN_CLIENT_KEY__,
|
ADYEN_CLIENT_KEY: process.env.__VUE_APP_ADYEN_CLIENT_KEY__,
|
||||||
ADYEN_ENVIRONMENT: process.env.__VUE_APP_ADYEN_ENVIRONMENT__,
|
ADYEN_ENVIRONMENT: process.env.__VUE_APP_ADYEN_ENVIRONMENT__,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ export const autoRouteTable = [
|
||||||
routeData.MOLDING_QUESTIONS,
|
routeData.MOLDING_QUESTIONS,
|
||||||
routeData.VEHICLE_PARTS,
|
routeData.VEHICLE_PARTS,
|
||||||
routeData.PART_QUESTIONS,
|
routeData.PART_QUESTIONS,
|
||||||
routeData.VIN_LOOKUP,
|
|
||||||
routeData.ESTIMATE,
|
routeData.ESTIMATE,
|
||||||
routeData.VEHICLE_DAMAGE,
|
routeData.VEHICLE_DAMAGE,
|
||||||
routeData.VEHICLE,
|
routeData.VEHICLE,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue