From 30c067c12c957889b66f4f2f1bb2976887f15aa5 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Wed, 12 Mar 2025 00:00:08 +0330 Subject: [PATCH] fixed api bug --- resources/js/client-custom/customerActions.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/js/client-custom/customerActions.js b/resources/js/client-custom/customerActions.js index 461b098..28d5303 100644 --- a/resources/js/client-custom/customerActions.js +++ b/resources/js/client-custom/customerActions.js @@ -5,7 +5,7 @@ window.addEventListener('load', function () { document.querySelectorAll('.fav-btn')?.forEach(function (el) { el.addEventListener('click', async function () { let resp = await axios.get(favUrl+this.getAttribute('data-slug')); - if (resp.data.success){ + if (resp.data.OK){ this.setAttribute('data-is-fav',resp.data.data); window.$toast.success(resp.data.message); }else { @@ -16,7 +16,7 @@ window.addEventListener('load', function () { document.querySelectorAll('.compare-btn')?.forEach(function (el) { el.addEventListener('click', async function () { let resp = await axios.get(compUrl+this.getAttribute('data-slug')); - if (resp.data.success){ + if (resp.data.OK){ window.$toast.success(resp.data.message); }else { window.$toast.error("Error!"); @@ -28,7 +28,7 @@ window.addEventListener('load', function () { el.addEventListener('click', async function (e) { e.preventDefault(); let resp = await axios.get(this.getAttribute('href')); - if (resp.data.success){ + if (resp.data.OK){ window.$toast.success(resp.data.message); document.querySelectorAll('.card-count')?.forEach(function (el2) { el2.innerText = resp.data.data.count;