import { storeActions } from "@/constants/store-actions"; import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper"; import router from "@/router"; import { FUNNEL_START_PAGE } from "@/router/constants/routes"; import store from "@/store"; export async function restartBeforeEnter(to, from) { await store.dispatch(storeActions.RESET_STATE); deleteFunnelCookie(); if (from.name === FUNNEL_START_PAGE.name) { // Router won't load the page if we redirect to the already existing page // Force refresh in this scenario. router.go(0); return false; } return { name: FUNNEL_START_PAGE.name, replace: true, }; }