Remove premature consumption of zip query

This commit is contained in:
Chloe Herd 2025-06-05 14:04:44 -04:00
parent 03ecb2743f
commit b3fd46350f
2 changed files with 11 additions and 2 deletions

View file

@ -62,7 +62,7 @@ import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
import baseMixin from "@/mixins/base-mixin.js";
import { queryStrings } from "@/constants/query-strings";
import { nextTick } from "vue";
import { consumeQueryFromStash } from "@/router/methods/helpers/querystring-stash";
import { peekQueryFromStash } from "@/router/methods/helpers/querystring-stash";
// Define Validation Rules
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
@ -100,7 +100,7 @@ export default {
}
const zip =
consumeQueryFromStash(queryStrings.ZIP_CODE) ??
peekQueryFromStash(queryStrings.ZIP_CODE) ??
store.getters.order.serviceLocation.zipCode;
var vinByAddressPromise;

View file

@ -1,4 +1,5 @@
import { reactive } from "vue";
import { debugLog } from "@/helpers/debug-log-helper";
const queryStash = reactive({
queries: [],
@ -27,10 +28,18 @@ export function stashAllQueries(toRoute) {
}
function getStashedQuery(key) {
debugLog(`Fetching querystring with key:`, key);
const match = queryStash.queries.find(
(entry) => entry?.key?.toLowerCase() === key?.toLowerCase()
);
if (match) {
debugLog(`Found result:`, match.value);
debugLog(`Already consumed:`, match.used);
} else {
debugLog(`Found no result`);
}
return match;
}