import { queryStrings } from "@/constants/query-strings";
import { storeMutations } from "@/constants/store-mutations";
import { routeData } from "@/router/constants/routes";
import { isVerifiedInsurance } from "@/router/methods/helpers/requires-verified-redirect";
import store from "@/store";

export async function quoteBeforeEnter(to, from) {
    if (isVerifiedInsurance()) {
        return {
            name: routeData.HERITAGE.name,
            replace: true,
        };
    }

    const offerQuote = to.query?.[queryStrings.OFFER_QUOTE];

    if (offerQuote === "true") {
        store.commit(storeMutations.UPDATE_IS_INSURANCE, false);
    }
}
