This commit is contained in:
2025-06-26 09:22:53 +02:00
parent 10b9610918
commit 8bab93274b
20 changed files with 13551 additions and 63 deletions

View File

@ -1,3 +0,0 @@
<svg width="26" height="25" viewBox="0 0 26 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.2724 22.8291C5.2724 23.0552 5.31265 23.2791 5.39086 23.488C5.46907 23.6969 5.5837 23.8867 5.7282 24.0466C5.87271 24.2065 6.04427 24.3333 6.23308 24.4198C6.42189 24.5064 6.62426 24.5509 6.82862 24.5509C7.24136 24.5509 7.63719 24.3695 7.92904 24.0466C8.07355 23.8867 8.18818 23.6969 8.26639 23.488C8.34459 23.2791 8.38485 23.0552 8.38485 22.8291C8.38485 22.3724 8.22089 21.9345 7.92904 21.6116C7.63719 21.2887 7.24136 21.1073 6.82862 21.1073C6.41588 21.1073 6.02005 21.2887 5.7282 21.6116C5.43636 21.9345 5.2724 22.3724 5.2724 22.8291ZM19.2784 22.8291C19.2784 23.0552 19.3187 23.2791 19.3969 23.488C19.4751 23.6969 19.5897 23.8867 19.7342 24.0466C19.8787 24.2065 20.0503 24.3333 20.2391 24.4198C20.4279 24.5064 20.6303 24.5509 20.8346 24.5509C21.2474 24.5509 21.6432 24.3695 21.9351 24.0466C22.0796 23.8867 22.1942 23.6969 22.2724 23.488C22.3506 23.2791 22.3909 23.0552 22.3909 22.8291C22.3909 22.3724 22.2269 21.9345 21.9351 21.6116C21.6432 21.2887 21.2474 21.1073 20.8346 21.1073C20.4219 21.1073 20.0261 21.2887 19.7342 21.6116C19.4424 21.9345 19.2784 22.3724 19.2784 22.8291ZM0.558594 1.30623C0.558594 1.53456 0.640573 1.75353 0.786498 1.91498C0.932422 2.07644 1.13034 2.16714 1.33671 2.16714H2.95362L3.92004 6.74032L5.2724 14.2199C5.2724 14.2819 5.29885 14.3353 5.30508 14.3956L4.51296 18.3386C4.48735 18.4644 4.4877 18.595 4.51399 18.7206C4.54028 18.8463 4.59182 18.9638 4.66479 19.0644C4.73776 19.165 4.83027 19.2461 4.93547 19.3016C5.04066 19.3572 5.15582 19.3859 5.2724 19.3854H22.9262C23.1326 19.3854 23.3305 19.2947 23.4764 19.1333C23.6223 18.9718 23.7043 18.7528 23.7043 18.5245C23.7043 18.2962 23.6223 18.0772 23.4764 17.9158C23.3305 17.7543 23.1326 17.6636 22.9262 17.6636H6.24348L6.59986 15.8901C6.67767 15.9039 6.7477 15.9418 6.82862 15.9418H21.0136C21.8726 15.9418 22.3909 15.7541 22.8048 14.6504L25.3321 6.07225C25.771 4.53466 24.8077 3.88897 23.9471 3.88897H5.2724C5.15101 3.88897 5.04519 3.93546 4.93158 3.96473L4.32777 1.10994C4.28774 0.920801 4.19107 0.752202 4.05348 0.63154C3.91589 0.510878 3.74546 0.445247 3.56989 0.445313H1.33671C1.13034 0.445313 0.932422 0.536016 0.786498 0.697469C0.640573 0.858921 0.558594 1.0779 0.558594 1.30623ZM5.30352 5.6108H23.8304L21.3466 14.046C21.3171 14.1201 21.2922 14.1735 21.2735 14.2096C21.2221 14.2148 21.1412 14.2199 21.0136 14.2199H6.82862V14.0495L6.79905 13.8825L5.30352 5.6108Z" fill="#FFFEFB"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,35 @@
.Toastify__toast {
font-family: var(--font-inter);
background-color: var(--color-bg-light);
border: 2px solid var(--color-block);
color: var(--color-bg-dark);
border-radius: 8px;
box-shadow: none;
}
.dark .Toastify__toast {
background-color: var(--color-bg-dark);
border: 1px solid var(--color-block);
color: #ffffff;
}
.Toastify__toast--error {
background-color: #dc3545;
color: #fff;
}
.dark .Toastify__toast--error {
background-color: #c82333;
}
.Toastify__progress-bar {
background-color: var(--color-accent-green-dark);
}
.Toastify__toast--success .Toastify__toast-icon svg {
fill: var(--color-accent-green-dark);
}
.dark .Toastify__close-button {
color: #fff;
}

View File

@ -1,11 +1,16 @@
<template>
<div ref="dropdownRef">
<i @click="openCart = !openCart" class="uil uil-shopping-cart text-[31px] cursor-pointer"></i>
<div
<div @click="openCart = !openCart" class="relative cursor-pointer">
<i class="uil uil-shopping-cart text-[31px]"></i>
<div v-if="productStore.cart.cart_items && productStore.cart.cart_items.length > 0"
class="w-[15px] h-[15px] rounded-full bg-accent-green-light dark:bg-accent-green-light text-white flex items-center justify-center text-[9px] absolute top-1 right-0">
{{ productStore.cart.cart_items.length }}</div>
</div>
<div v-if="openCart" @click.self="openCart = !openCart"
class="absolute left-1/2 transform -translate-x-1/2 w-full px-4 sm:max-w-[768px] sm:px-[17px] md:max-w-[1000px] md:px-6 xl:max-w-[1920px] xl:px-20 right-0 z-50 flex items-center justify-end top-[90px] sm:top-[100px] md:top-[140px]">
<div v-if="openCart" class="xl:w-[55%] md:w-[90%] w-full px-4 md:px-0">
<div class="xl:w-[55%] md:w-[90%] w-full px-4 md:px-0">
<div v-if="productStore.cart.cart_items && productStore.cart.cart_items.length > 0"
class="w-full p-[25px] sm:p-[50px] bg-bg-light dark:bg-bg-dark border border-button rounded-[32px] h-full space-25-55">
class="w-full p-[25px] sm:p-[50px] bg-bg-light dark:bg-bg-dark border border-button rounded-xl sm:rounded-[32px] h-full space-25-55">
<div>
<!-- product -->
<div v-for="item in productStore.cart.cart_items"

View File

@ -7,7 +7,7 @@
<ul class="flex items-center justify-between whitespace-nowrap w-full">
<li v-for="(item, index) in menuStore.menu" @click="menuStore.navigateToItem(item)" :key="item.id"
:class="['hover:text-accent-green-light dark:hover:text-accent-green-dark cursor-pointer text-lg transition-all text-inter',
route.params.id == item.id ? 'text-accent-green-light dark:text-accent-green-dark font-bold underline' : false]">
route.params.id == item.id.toString() ? 'text-accent-green-light dark:text-accent-green-dark font-bold underline' : false]">
0{{ index + 1 }} <br />
{{ item.front_menu_lang[0].name }}
</li>
@ -29,7 +29,7 @@
<button @click="menuStore.navigateToShop" :class="[
'cursor-pointer transition-all text-inter',
route.params.id == '5'
? 'text-accent-green-light dark:text-accent-green-dark font-bold pb-1 border-b-2 bg-accented px-6 py-3 rounded-xl'
? 'text-accent-green-light dark:text-accent-green-dark font-bold pb-1 border-b-2'
: 'hover:bg-button-hover bg-button text-white font-medium rounded-xl px-6 py-3'
]">
{{ $t('eshop') }}
@ -112,10 +112,10 @@
open = false;
}
" :key="index"
:class="['flex items-center justify-between transition-all hover:text-accent-green-light dark:hover:text-accent-green-dark cursor-pointer', route.params.slug === item.link_rewrite && 'text-accent-green-light dark:text-accent-green-dark font-bold underline']">
:class="['flex items-center justify-between transition-all hover:text-accent-green-light dark:hover:text-accent-green-dark cursor-pointer', route.params.slug === item.front_menu_lang[0].link_rewrite && 'text-accent-green-light dark:text-accent-green-dark font-bold underline']">
<div class="leading-[70%] text-inter">
<span class="mr-4">0{{ index + 1 }}</span>
{{ item.name }}
{{ item.front_menu_lang[0].name }}
</div>
<!-- <i class="uil uil-arrow-up-right text-[35px]"></i> -->
<svg class="" width="20" height="20" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
@ -132,7 +132,7 @@
</div>
<div class="flex items-center justify-between">
<p class="leading-[70%] text-inter">
{{ $t("change_currency_country") }}
{{ $t("change_currency_and_country") }}
</p>
<CountryCurrencySelector />
</div>
@ -172,10 +172,10 @@
open = false;
}
" :key="index"
:class="['flex items-center justify-between transition-all hover:text-accent-green-light dark:hover:text-accent-green-dark cursor-pointer', route.params.slug === item.link_rewrite && 'text-accent-green-light dark:text-accent-green-dark font-bold underline']">
:class="['flex items-center justify-between transition-all hover:text-accent-green-light dark:hover:text-accent-green-dark cursor-pointer', route.params.slug === item.front_menu_lang[0].link_rewrite && 'text-accent-green-light dark:text-accent-green-dark font-bold underline']">
<div class="leading-[70%] text-inter">
<span class="mr-4">0{{ index + 1 }}</span>
{{ item.name }}
{{ item.front_menu_lang[0].name }}
</div>
<!-- <i class="uil uil-arrow-up-right text-[35px]"></i> -->
<svg class="" width="20" height="20" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
@ -192,7 +192,7 @@
</div>
<div class="flex items-center justify-between">
<p class="leading-[70%] text-lg text-inter">
{{ $t("change_currency_country") }}
{{ $t("change_currency_and_country") }}
</p>
<CountryCurrencySelector />
</div>

View File

@ -0,0 +1,7 @@
<template>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Veritatis dignissimos impedit eligendi quaerat. Doloribus
eius nisi facere suscipit pariatur reprehenderit reiciendis tempora est accusamus adipisci hic voluptate asperiores,
voluptas enim.
</template>
<script lang="ts" setup></script>

View File

@ -8,12 +8,12 @@
<div class="p-[25px] md:p-[50px] bg-block rounded-2xl space-y-[30px] xl:ml-40 xl:w-[65%]">
<div class="flex gap-[30px]">
<input :placeholder="$t('first_name')" type="text"
class="border border-text-dark placeholder:text-button rounded-lg px-3 py-1.5 w-full focus:outline-none focus:ring-0 focus:border-2 text-button" />
class="border border-button placeholder:text-button rounded-lg px-3 py-1.5 w-full focus:outline-none focus:ring-0 focus:border-2 text-button" />
<input :placeholder="$t('email')" type="text"
class="border border-text-dark placeholder:text-button rounded-lg px-3 py-1.5 w-full focus:outline-none focus:ring-0 focus:border-2 text-button" />
class="border border-button placeholder:text-button rounded-lg px-3 py-1.5 w-full focus:outline-none focus:ring-0 focus:border-2 text-button" />
</div>
<textarea :placeholder="$t('form_question')"
class="border h-[276px] border-text-dark placeholder:text-button rounded-lg px-3 py-1.5 w-full focus:outline-none focus:ring-0 focus:border-2 text-button" />
class="border h-[276px] border-button placeholder:text-button rounded-lg px-3 py-1.5 w-full focus:outline-none focus:ring-0 focus:border-2 text-button" />
<div class="w-full flex justify-center sm:justify-start">
<UiButtonArrow type="border">{{

View File

@ -43,7 +43,7 @@
<p class="text-accent-green-light text-bold-24">
{{ item.formatted_price }}
</p>
<button
<button @click="productStore.incrementCartItem(item.id)"
class="w-9 h-9 md:w-12 md:h-12 rounded-xl bg-button cursor-pointer hover:bg-button-hover transition-all flex items-center justify-center">
<i class="uil uil-shopping-cart text-[25px] md:text-[24px] text-bg-light"></i>
</button>
@ -52,7 +52,7 @@
</div>
</div>
<UiButtonArrow :arrow="true" class="mx-auto" type="fill">{{ $t('eshop') }}</UiButtonArrow>
<UiButtonArrow @click="menuStore.navigateToShop" :arrow="true" class="mx-auto" type="fill">{{ $t('eshop') }}</UiButtonArrow>
</div>
<!-- calculator-block -->
@ -107,7 +107,7 @@
</div>
<UiButtonArrow :arrow="true" type="fill" class="mx-auto sm:m-0">{{
component.front_section_lang[0].data.button
}}</UiButtonArrow>
}}</UiButtonArrow>
</div>
</div>
</div>

View File

@ -1,12 +1,7 @@
<template>
<UiContainer
class="flex flex-wrap items-center justify-between gap-[30px] sm:gap-y-[55px] xl:gap-y-[100px]"
>
<div
class="w-full flex flex-col gap-[25px] xl:max-w-[48%] md:mx-10 xl:m-0"
v-for="(item, index) in component.front_section_lang[0].data"
:key="index"
>
<UiContainer class="flex flex-wrap items-center justify-between gap-[30px] sm:gap-y-[55px] xl:gap-y-[100px]">
<div class="w-full flex flex-col gap-[25px] xl:max-w-[48%] md:mx-10 xl:m-0"
v-for="(item, index) in component.front_section_lang[0].data" :key="index">
<!-- xl -->
<div class="hidden xl:flex xl:h-[330px] flex-col justify-between">
<div class="space-y-[55px]">
@ -29,23 +24,19 @@
backgroundImage: `url('/api/public/file/${component.img[index]}_l.webp')`,
backgroundSize: 'cover',
backgroundPosition: 'center',
}"
>
}">
<div
class="hidden sm:block absolute bottom-0 right-0 pt-2 pl-2 bg-bg-light dark:bg-bg-dark rounded-tl-2xl"
>
class="hidden sm:block absolute bottom-0 right-0 pt-2 pl-2 bg-bg-light dark:bg-bg-dark rounded-tl-2xl">
<UiButtonArrow :arrow="true">{{ item.title }}</UiButtonArrow>
</div>
</div>
<UiButtonArrow :arrow="true" class="sm:hidden mx-auto">{{
item.title
}}</UiButtonArrow>
}}</UiButtonArrow>
</div>
<!-- Map block with same layout rules -->
<div
class="w-full xl:max-w-[48%] md:mx-10 xl:m-0 flex flex-col gap-4 items-center"
>
<div class="w-full xl:max-w-[48%] md:mx-10 xl:m-0 flex flex-col gap-4 items-center">
<h1 class="text-sm sm:text-xl uppercase">
Jsme tu pro vás napříč Evropou
</h1>

View File

@ -22,7 +22,7 @@
<p class="text-accent-green-light text-bold-24">
{{ item.formatted_price }}
</p>
<button
<button @click="productStore.incrementCartItem(item.id)"
class="w-9 h-9 md:w-12 md:h-12 rounded-xl bg-button cursor-pointer hover:bg-button-hover transition-all flex items-center justify-center">
<i class="uil uil-shopping-cart text-[25px] md:text-[24px] text-bg-light"></i>
</button>

View File

@ -1,10 +1,11 @@
<template>
<div
class="w-[150px] sm:w-[260px] md:w-[330px] px-2 py-3 sm:py-5 sm:px-[15px] bg-block rounded-2xl flex flex-col items-center gap-[15px] sm:gap-[50px]">
<img onerror="this.src='https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg?cs=srgb&dl=pexels-souvenirpixels-414612.jpg&fm=jpg'" :src="`https://www.yourgold.cz/api/public/file/${props.product?.cover_picture_uuid}.webp`" alt="pics"
class="max-h-[95px] sm:max-h-[180px] md:max-h-[205px] rounded-[5px]" />
<div class="flex flex-col justify-between h-full w-full gap-[7px] sSm:gap-[15px]"
@click="productStore.incrementCartItem(props.product?.id)">
<img :src="`https://www.yourgold.cz/api/public/file/${props.product?.cover_picture_uuid}.webp`" alt="Product Image"
class="max-h-[95px] sm:max-h-[180px] md:max-h-[205px] rounded-[5px]"
onerror="this.onerror=null; this.src='/photo.svg';" />
<div class="flex flex-col justify-between h-full w-full gap-[7px] sSm:gap-[15px]">
<div class="flex flex-col gap-[7px] sm:gap-[15px] w-full">
<h3 class="text-[10px] sm:text-base md:text-lg text-xl font-bold leading-[130%] sm:leading-[150%] text-bg-dark">
{{ props.product?.name }}
@ -17,7 +18,7 @@
<p class="text-accent-green-light font-inter text-[12px] sm:text-[21px] md:text-2xl leading-[150%] font-bold">
{{ props.product?.formatted_price }}
</p>
<button
<button @click="productStore.incrementCartItem(props.product?.id)"
class="w-[22px] h-[22px] sm:w-9 sm:h-9 md:w-12 md:h-12 rounded-[5px] text-bg-light sm:rounded-xl bg-button cursor-pointer hover:bg-button-hover transition-all flex items-center justify-center p-1">
<i class="uil uil-shopping-cart text-lg sm:text-2xl md:text-[31px] cursor-pointer"></i>
</button>

View File

@ -16,13 +16,19 @@ export default defineNuxtConfig({
// },
// },
modules: ["@pinia/nuxt", "@nuxt/eslint", "@nuxt/ui", "@nuxtjs/i18n", "@pinia/nuxt"],
modules: [
"@pinia/nuxt",
"@nuxt/eslint",
"@nuxt/ui",
"@nuxtjs/i18n",
"@pinia/nuxt",
],
i18n: {
locales: [
{ code: "pl", name: "Polski", icon: "circle-flags:pl" },
{ code: "en", name: "English", icon: "circle-flags:gb" },
{ code: "cs", name: "Čeština", icon: "circle-flags:cz" }
{ code: "cs", name: "Čeština", icon: "circle-flags:cz" },
],
lazy: true,
defaultLocale: "en",
@ -31,7 +37,11 @@ export default defineNuxtConfig({
optimizeTranslationDirective: false,
},
},
css: [ "@/assets/main.css" ],
css: [
"@/assets/main.css",
"vue3-toastify/dist/index.css",
"@/assets/toastify-custom.css",
],
vite: {
plugins: [tailwindcss()],
build: {
@ -44,7 +54,7 @@ export default defineNuxtConfig({
},
hmr: {
clientPort: 3000, // useful if proxying
}
},
},
},
typescript: {

View File

@ -20,7 +20,8 @@
"nuxt": "^3.17.4",
"tailwindcss": "^4.1.7",
"vue": "^3.5.14",
"vue-router": "^4.5.1"
"vue-router": "^4.5.1",
"vue3-toastify": "^0.2.8"
},
"devDependencies": {
"@nuxtjs/tailwindcss": "^6.14.0"

View File

@ -0,0 +1,10 @@
import * as Vue3Toastify from "vue3-toastify";
import "vue3-toastify/dist/index.css";
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(Vue3Toastify.default, { autoClose: 2000 });
return {
provide: { toast: Vue3Toastify.toast },
};
});

13388
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.29289 17.4628L0.585786 18.1699L2 19.5841L2.70711 18.877L1.29289 17.4628ZM19.9706 1.19936C19.9706 0.647074 19.5228 0.199359 18.9706 0.199359L9.97056 0.19936C9.41828 0.199359 8.97056 0.647075 8.97056 1.19936C8.97056 1.75164 9.41828 2.19936 9.97056 2.19936L17.9706 2.19936L17.9706 10.1994C17.9706 10.7516 18.4183 11.1994 18.9706 11.1994C19.5228 11.1994 19.9706 10.7516 19.9706 10.1994L19.9706 1.19936ZM2 18.1699L2.70711 18.877L19.6777 1.90647L18.9706 1.19936L18.2635 0.492253L1.29289 17.4628L2 18.1699Z" fill="#1A1A1A"/>
</svg>

Before

Width:  |  Height:  |  Size: 633 B

View File

@ -1,3 +0,0 @@
<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.7364 1.49211L2.0293 0.785005L0.615083 2.19922L1.32219 2.90633L2.7364 1.49211ZM18.9999 20.1698C19.5521 20.1698 19.9999 19.7221 19.9999 19.1698L19.9999 10.1698C19.9999 9.6175 19.5521 9.16978 18.9999 9.16978C18.4476 9.16978 17.9999 9.6175 17.9999 10.1698L17.9999 18.1698L9.99986 18.1698C9.44758 18.1698 8.99986 18.6175 8.99986 19.1698C8.99986 19.7221 9.44757 20.1698 9.99986 20.1698L18.9999 20.1698ZM2.0293 2.19922L1.32219 2.90633L18.2928 19.8769L18.9999 19.1698L19.707 18.4627L2.7364 1.49211L2.0293 2.19922Z" fill="#1A1A1A"/>
</svg>

Before

Width:  |  Height:  |  Size: 639 B

3
public/photo.svg Normal file
View File

@ -0,0 +1,3 @@
<svg width="76" height="53" viewBox="0 0 76 53" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M76 49.8V2C76 0.9 75.1 0 74 0H2C0.9 0 0 0.9 0 2V50C0 52.5 3.3 52 2 52H74C77 52 75.6 47.4 76 49.8ZM6 48L28 19.3L46.4 43.4L49.9 48H6ZM55 48L50.5 42.2L58 32.4L69.9 48H55ZM72 44L59.6 27.8C58.8 26.7 57.2 26.7 56.4 27.8L48 38.8L29.6 14.8C28.8 13.7 27.2 13.7 26.4 14.8L4 44.1V4H72V44ZM49 10C45.1 10 42 13.1 42 17C42 20.9 45.1 24 49 24C52.9 24 56 20.9 56 17C56 13.1 52.8 10 49 10ZM49 20C47.4 20 46 18.7 46 17C46 15.3 47.3 14 49 14C50.7 14 52 15.3 52 17C52 18.7 50.6 20 49 20Z" fill="#004F3D"/>
</svg>

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

View File

@ -9,6 +9,7 @@ import type {
import type { Product } from "~/types/product";
export const useProductStore = defineStore("productStore", () => {
const { $toast } = useNuxtApp();
const productList = ref<Product[]>();
const modules = ref();
@ -61,7 +62,7 @@ export const useProductStore = defineStore("productStore", () => {
async function incrementCartItem(id: number) {
try {
await useMyFetch(
const res = await useMyFetch<GenericResponse<object>>(
`/api/public/user/cart/item/add/${id}/1`,
{
method: "PUT",
@ -74,15 +75,30 @@ export const useProductStore = defineStore("productStore", () => {
}
);
getCart();
if (res.status === 200) {
$toast.success("Item successfully added to your cart.", {
autoClose: 5000,
dangerouslyHTMLString: true,
});
getCart();
} else {
$toast.error("Failed to add item to cart. Please try again.", {
autoClose: 5000,
dangerouslyHTMLString: true,
});
}
} catch (error) {
console.error("getList error:", error);
$toast.error("An unexpected error occurred while updating your cart.", {
autoClose: 5000,
dangerouslyHTMLString: true,
});
console.error("incrementCartItem error:", error);
}
}
async function decrementCartItem(id: number) {
try {
await useMyFetch(
const res = await useMyFetch<GenericResponse<object>>(
`/api/public/user/cart/item/subtract/${id}/1`,
{
method: "PUT",
@ -95,15 +111,30 @@ export const useProductStore = defineStore("productStore", () => {
}
);
getCart();
if (res.status === 200) {
$toast.success("Item successfully removed from your cart.", {
autoClose: 5000,
dangerouslyHTMLString: true,
});
getCart();
} else {
$toast.error("Failed to removed item from cart. Please try again.", {
autoClose: 5000,
dangerouslyHTMLString: true,
});
}
} catch (error) {
console.error("removeFromCart error:", error);
$toast.error("An unexpected error occurred while updating your cart.", {
autoClose: 5000,
dangerouslyHTMLString: true,
});
console.error("decrementCartItem error:", error);
}
}
async function deleteCartItem(id: number) {
try {
await useMyFetch(
const res = await useMyFetch<GenericResponse<object>>(
`/api/public/user/cart/item/${id}`,
{
method: "DELETE",
@ -116,9 +147,24 @@ export const useProductStore = defineStore("productStore", () => {
}
);
getCart();
if (res.status === 200) {
$toast.success("Item successfully removed from your cart.", {
autoClose: 5000,
dangerouslyHTMLString: true,
});
getCart();
} else {
$toast.error("Failed to removed item from cart. Please try again.", {
autoClose: 5000,
dangerouslyHTMLString: true,
});
}
} catch (error) {
console.error("removeFromCart error:", error);
$toast.error("An unexpected error occurred while updating your cart.", {
autoClose: 5000,
dangerouslyHTMLString: true,
});
console.error("deleteCartItem error:", error);
}
}