@@ -199,85 +191,37 @@ export default defineComponent({
@@ -348,6 +348,7 @@ export default defineComponent({
:imgSrc="image"
:isNew="isNew"
:id="id"
+ :hasPostalCode="(postalCode !== 'undefined')?true:false"
/>
diff --git a/src/stores/cart.js b/src/stores/cart.js
index e7e6a0f..ba45295 100644
--- a/src/stores/cart.js
+++ b/src/stores/cart.js
@@ -147,11 +147,10 @@ export const useCartStore = defineStore("cart", () => {
routeId.value = id;
try {
const params = transformOptionsToParams(options);
-
const promises = [
- apiBack.get(`products/${+id - 1}`),
- apiBack.get(`products/${+id}`),
- apiBack.get(`products/${+id + 1}`),
+ apiBack.get(`products/${+id - 1}`, { params }),
+ apiBack.get(`products/${+id}`, { params }),
+ apiBack.get(`products/${+id + 1}`, { params }),
];
const results = await Promise.allSettled(promises);
const [prev, current, next] = results.map((res) => {
@@ -195,13 +194,13 @@ export const useCartStore = defineStore("cart", () => {
const params = transformOptionsToParams(
availabilityForm.value || availability.value
);
- await getProducts(params);
+ const correctProduct = await apiBack.get(`products/${product.id}`, { params });
const hasCurrentProduct = computed(() => {
return cart.value.find((p) => p.id === product.id);
});
- if (isEmpty.value) {
+ if (correctProduct.data.length === 0) {
push("/");
return quasarNotify({
message:
@@ -210,15 +209,6 @@ export const useCartStore = defineStore("cart", () => {
});
}
- if (!products.value.data.some((item) => item.id === product.id)) {
- push("/");
- return quasarNotify({
- message:
- "Este producto no está disponible en su zona, intente añadir un nuevo código postal",
- type: "erro",
- });
- }
-
if (hasCurrentProduct.value) {
return quasarNotify({
message: "Este producto ya está en el carrito",
diff --git a/src/stores/textInput.js b/src/stores/textInput.js
deleted file mode 100644
index c66136a..0000000
--- a/src/stores/textInput.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import { defineStore } from "pinia";
-
-export const useTextInputStore = defineStore("text-input", () => {
- const dedication = ref("");
-
- function handleDedicationSubmit() {
- console.log(dedication);
- }
-
- return {
- dedication,
- handleDedicationSubmit,
- };
-});
diff --git a/src/utils/zod/schemas/questionSchema.js b/src/utils/zod/schemas/questionSchema.js
index e442278..c0131ed 100644
--- a/src/utils/zod/schemas/questionSchema.js
+++ b/src/utils/zod/schemas/questionSchema.js
@@ -15,9 +15,6 @@ const questionObjVal = {
phone: z
.string({ required_error: M.requiredMessage })
.min(1, M.requiredMessage),
- query: z
- .string({ required_error: M.requiredMessage })
- .min(1, M.requiredMessage),
message: z
.string({ required_error: M.requiredMessage })
.min(1, M.requiredMessage),