fix discount error

master
حسین معصومی پور 2024-06-12 18:23:30 +03:30
parent 201c72a7f7
commit 8ece2f8d09
16 changed files with 305 additions and 169 deletions

View File

@ -6,4 +6,4 @@ NEXT_PUBLIC_PUBLIC_URL=https://api.vesmeh.com
NEXT_PUBLIC_API_URL=https://api.vesmeh.com/api
NEXT_PUBLIC_STORAGE_URL=http://storage.vesmeh.com
STORAGE_URL=http://storage.vesmeh.com
NEXT_PUBLIC_PACKAGE_VERSION=1.0.0.1
NEXT_PUBLIC_PACKAGE_VERSION=1.0.2.4

View File

@ -15,4 +15,5 @@ CMD ["node_modules/.bin/next", "start"]
# docker build -f Dockerfile.x -t registry.vnfco.ir/netinashop/vesmeh:0.32.31 .
# docker build -f Dockerfile.x -t registry.vnfco.ir/netinashop/vesmeh:0.32.31 .
#

View File

@ -102,6 +102,22 @@ const CheckoutData = () => {
}
};
const deleteDiscount = async () => {
try {
// Send a POST request to the API endpoint to apply discount
const data = await Chapar.post(
`${process.env.NEXT_PUBLIC_API_URL}/order/bag/discount/${checkOutData?.id}`
);
CTX.setCheckOutData(data);
} catch ({ error, status }) {
// If there's an error, display an error message using toast
toast.error(`${error?.response?.data?.message}`, {
position: "bottom-right",
closeOnClick: true,
});
}
};
useEffect(() => {
if (shippingData.length <= 0) {
GetShippingData();
@ -122,6 +138,8 @@ const CheckoutData = () => {
setPermissionGoPay(false);
}, []);
console.log("checkOutData", checkOutData);
return (
<>
<div className=" pb-20">
@ -343,30 +361,57 @@ const CheckoutData = () => {
>
<div className="flex">
<div>
<svg
width="25"
height="25"
viewBox="0 0 244 194"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="opacity-70 mt-2"
>
<path
d="M122 93.875V100.125M122 47V53.25M122 140.75V147M209.5 184.5C216.13 184.5 222.489 181.866 227.178 177.178C231.866 172.489 234.5 166.13 234.5 159.5V122C227.87 122 221.511 119.366 216.822 114.678C212.134 109.989 209.5 103.63 209.5 97C209.5 90.3696 212.134 84.0107 216.822 79.3223C221.511 74.6339 227.87 72 234.5 72V34.5C234.5 27.8696 231.866 21.5107 227.178 16.8223C222.489 12.1339 216.13 9.5 209.5 9.5H34.5C27.8696 9.5 21.5107 12.1339 16.8223 16.8223C12.1339 21.5107 9.5 27.8696 9.5 34.5V72C16.1304 72 22.4893 74.6339 27.1777 79.3223C31.8661 84.0107 34.5 90.3696 34.5 97C34.5 103.63 31.8661 109.989 27.1777 114.678C22.4893 119.366 16.1304 122 9.5 122V159.5C9.5 166.13 12.1339 172.489 16.8223 177.178C21.5107 181.866 27.8696 184.5 34.5 184.5H209.5Z"
stroke="black"
stroke-opacity="0.54"
stroke-width="18.75"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
{checkOutData?.discountCode == "" ? (
<svg
width="25"
height="25"
viewBox="0 0 244 194"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="opacity-70 mt-2"
>
<path
d="M122 93.875V100.125M122 47V53.25M122 140.75V147M209.5 184.5C216.13 184.5 222.489 181.866 227.178 177.178C231.866 172.489 234.5 166.13 234.5 159.5V122C227.87 122 221.511 119.366 216.822 114.678C212.134 109.989 209.5 103.63 209.5 97C209.5 90.3696 212.134 84.0107 216.822 79.3223C221.511 74.6339 227.87 72 234.5 72V34.5C234.5 27.8696 231.866 21.5107 227.178 16.8223C222.489 12.1339 216.13 9.5 209.5 9.5H34.5C27.8696 9.5 21.5107 12.1339 16.8223 16.8223C12.1339 21.5107 9.5 27.8696 9.5 34.5V72C16.1304 72 22.4893 74.6339 27.1777 79.3223C31.8661 84.0107 34.5 90.3696 34.5 97C34.5 103.63 31.8661 109.989 27.1777 114.678C22.4893 119.366 16.1304 122 9.5 122V159.5C9.5 166.13 12.1339 172.489 16.8223 177.178C21.5107 181.866 27.8696 184.5 34.5 184.5H209.5Z"
stroke="black"
stroke-opacity="0.54"
stroke-width="18.75"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
) : (
<svg
width="25"
height="25"
viewBox="0 0 220 133"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="opacity-70 mt-2"
>
<path
d="M17.062 71.0875C16.2612 70.1317 15.2777 69.3452 14.1692 68.7742C13.0607 68.2032 11.8494 67.859 10.6062 67.7619C9.36305 67.6648 8.11299 67.8166 6.92923 68.2085C5.74548 68.6005 4.6518 69.2246 3.71224 70.0445C2.77268 70.8643 2.0061 71.8633 1.4574 72.9831C0.9087 74.1028 0.588891 75.3208 0.516701 76.5657C0.444511 77.8105 0.621389 79.0573 1.03698 80.2329C1.45257 81.4086 2.09853 82.4895 2.93702 83.4125L17.062 71.0875ZM49.287 122.25L42.2245 128.412C43.1045 129.421 44.19 130.228 45.4082 130.782C46.6264 131.336 47.949 131.622 49.287 131.622C50.6251 131.622 51.9477 131.336 53.1658 130.782C54.384 130.228 55.4696 129.421 56.3495 128.412L49.287 122.25ZM154.562 15.9125C155.401 14.9896 156.046 13.9086 156.462 12.7329C156.878 11.5573 157.055 10.3105 156.982 9.06565C156.91 7.82079 156.59 6.60283 156.042 5.48309C155.493 4.36334 154.726 3.36431 153.787 2.54448C152.847 1.72465 151.754 1.1005 150.57 0.708553C149.386 0.31661 148.136 0.164754 146.893 0.261882C145.65 0.35901 144.438 0.70317 143.33 1.27421C142.221 1.84524 141.238 2.63169 140.437 3.58749L154.562 15.9125ZM91.3245 59.8375C89.7486 61.7184 88.9729 64.1422 89.1641 66.5886C89.3552 69.035 90.4979 71.309 92.3468 72.9223C94.1958 74.5357 96.6036 75.3597 99.0533 75.2177C101.503 75.0756 103.799 73.9787 105.45 72.1625L91.3245 59.8375ZM80.8995 100.287C81.738 99.3646 82.384 98.2836 82.7996 97.1079C83.2152 95.9323 83.392 94.6855 83.3199 93.4407C83.2477 92.1958 82.9278 90.9778 82.3792 89.8581C81.8304 88.7383 81.0639 87.7393 80.1243 86.9195C79.1847 86.0997 78.0911 85.4755 76.9073 85.0836C75.7236 84.6916 74.4735 84.5398 73.2303 84.6369C71.9872 84.734 70.7759 85.0782 69.6673 85.6492C68.5588 86.2202 67.5754 87.0067 66.7745 87.9625L80.8995 100.287ZM2.93702 83.4125L42.2245 128.412L56.3495 116.087L17.062 71.0875L2.93702 83.4125ZM56.3495 128.412L80.8995 100.287L66.7745 87.9625L42.2245 116.087L56.3495 128.412ZM105.45 72.1625L130.012 44.0375L115.887 31.7125L91.3245 59.8375L105.45 72.1625ZM130.012 44.0375L154.562 15.9125L140.437 3.58749L115.887 31.7125L130.012 44.0375Z"
fill="#00431B"
/>
<path
d="M210 10.5371L156.425 66.7871M97.5 116L102.862 123.037L129.65 94.9121"
stroke="#00431B"
stroke-width="18.75"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
)}
</div>
<div className="mx-2">
<h3 className="mb-0 text-sm text-right font-medium text-primary-500 ">
افزودن کد تخفیف{" "}
{checkOutData?.discountCode == ""
? "افزودن کد تخفیف"
: "تخفیف ثبت شد"}
</h3>
<p className="mb-0 text-[12px] text-gray-500">
کد تخفیف خود را وارد کنید
{checkOutData?.discountCode == ""
? "کد تخفیف خود را وارد کنید"
: `تخفیف با کد ${checkOutData?.discountCode} ثبت شده است`}
</p>
</div>
</div>
@ -376,10 +421,27 @@ const CheckoutData = () => {
<span className="text-[30px] opacity-60">+</span>
</div>
) : (
<div className="text-right flex justify-end px-2 py-1 mx-2">
<p className="text-green-600 mb-0 text-[12px] ">
کد تخفیف ثبت شد{" "}
</p>
<div
className="text-right flex justify-end px-2 py-1 mx-2 cursor-pointer"
onClick={() => deleteDiscount()}
>
<div className=" h-fit">
<svg
width="25"
height="25"
viewBox="0 0 104 122"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M89.5 42.25L84.25 94.7375C83.4562 102.694 83.0625 106.669 81.25 109.675C79.6603 112.321 77.3224 114.437 74.5312 115.756C71.3625 117.25 67.375 117.25 59.375 117.25H44.625C36.6312 117.25 32.6375 117.25 29.4688 115.75C26.6753 114.432 24.3351 112.316 22.7437 109.669C20.9437 106.669 20.5438 102.694 19.7438 94.7375L14.5 42.25M61.375 82.875V51.625M42.625 82.875V51.625M5.125 26.625H33.9687M33.9687 26.625L36.3813 9.925C37.0813 6.8875 39.6062 4.75 42.5062 4.75H61.4938C64.3938 4.75 66.9125 6.8875 67.6187 9.925L70.0313 26.625M33.9687 26.625H70.0313M70.0313 26.625H98.875"
stroke="#A80000"
stroke-width="9.375"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
</div>
)}
</div>

View File

@ -252,17 +252,7 @@ const ProductData = ({ params, data }) => {
</p>
<p className=" xs:block lg:hidden mb-0 text-[12px]">مشخصات</p>
</div>
<div
className={` rounded-full xs:p-2 lg:p-3 cursor-pointer tr03 ${
productBarDetail == 1 ? "bg-primary-500 text-gray-100" : ""
}`}
onClick={() => {
setProductBarDetail(1);
scrollToSection("section1");
}}
>
<p className="mb-0 text-[13px] ">روش استفاده</p>
</div>
<div
className={` rounded-full xs:p-2 lg:p-3 cursor-pointer tr03 ${
productBarDetail == 2 ? "bg-primary-500 text-gray-100" : ""
@ -316,19 +306,6 @@ const ProductData = ({ params, data }) => {
</div>
</div>
<div id="section1">
<h3 className=" text-sm text-gray-400 mt-7 mb-2">
روش استفاده
</h3>
<div className="border p-5 rounded-lg">
<div className="flex justify-center py-5">
<div className="bg-white shadow w-fit rounded-full text-sm p-4">
چیزی یافت نشد
</div>
</div>
</div>{" "}
</div>
<div id="section2">
<h3 className=" text-sm text-gray-400 mt-7 mb-2">
نقد و برسی{" "}

View File

@ -56,6 +56,7 @@ const RootData = ({ children }) => {
const [specialOfferData, setSpecialOfferData] = useState([]);
const [cosmeticData, setCosmeticData] = useState([]);
const [HomeCosmeticData, setHomeCosmeticData] = useState([]);
const [sunCreamData, setSunCreamData] = useState([]);
const [isChecked, setIsChecked] = useState(false);
const [selectedBrands, setSelectedBrands] = useState([]);
@ -352,13 +353,7 @@ const RootData = ({ children }) => {
const data = await Chapar.post(
`${process.env.NEXT_PUBLIC_API_URL}/order/bag/submit`,
JSON.stringify(productsToSend),
{
headers: {
Authorization: localStorage.getItem("token"),
},
}
JSON.stringify(productsToSend)
);
setCheckOutData(data);
@ -459,6 +454,14 @@ const RootData = ({ children }) => {
setHomeCosmeticData(HomeCosmetic);
};
const fetchSunCream = async () => {
const res = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/product?page=0&categoryId=df80c111-087f-4b2d-bc32-c44d660e76f2`
);
const sunCream = await res.json();
setSunCreamData(sunCream);
};
useEffect(() => {
const storedCart = localStorage.getItem("cart");
const token = localStorage.getItem("token");
@ -537,6 +540,7 @@ const RootData = ({ children }) => {
cosmeticData,
HomeCosmeticData,
specialOfferData,
sunCreamData,
},
setCart,
setProducts,
@ -573,6 +577,7 @@ const RootData = ({ children }) => {
fetchProducts,
setCloseNavbar,
setAddressData,
setSunCreamData,
fetchAddressUser,
fetchOrderBagCheck,
fetchOrderUser,
@ -587,6 +592,7 @@ const RootData = ({ children }) => {
fetchHomeCosmetic,
fetchCosmetic,
fetchSpecialOffer,
fetchSunCream,
}}
>
{children}

View File

@ -184,14 +184,14 @@ const Footer = () => {
<a
referrerpolicy="origin"
target="_blank"
href="https://trustseal.enamad.ir/?id=274373&Code=FSm0y9hlccuslQp7UNJT"
href="https://trustseal.enamad.ir/?id=1002046&Code=uEUYF7tTs21rJyBGgWSS4zX2rpVUqXBH"
>
<img
referrerpolicy="origin"
src="https://trustseal.enamad.ir/logo.aspx?id=274373&Code=FSm0y9hlccuslQp7UNJT"
src="https://trustseal.enamad.ir/logo.aspx?id=1002046&Code=uEUYF7tTs21rJyBGgWSS4zX2rpVUqXBH"
alt=""
style={{ cursor: "pointer" }}
Code="FSm0y9hlccuslQp7UNJT"
code="uEUYF7tTs21rJyBGgWSS4zX2rpVUqXBH"
/>
</a>
</div>

View File

@ -1,8 +1,10 @@
import Image from "next/image";
import Link from "next/link";
import between from "../../../public/images/between.jpg";
import between1 from "../../../public/images/between1.png";
import between2 from "../../../public/images/between2.png";
import w1 from "@img/w1.jpg";
import w2 from "@img/w2.jpg";
import w3 from "@img/w3.jpg";
import PersianNumber from "plugins/PersianNumber";
const BetweenSexualSection = () => {
return (
@ -19,8 +21,8 @@ const BetweenSexualSection = () => {
</div>
</div>
<div className="bg-gray-100 relative xs:left-[0px] lg:left-[30px] xs:top-[-35px] lg:top-0 col-span-2 z-0 rounded-3xl xs:pr-5 lg:pr-[55px] xs:pt-[55px] lg:pt-10 pl-5">
<div className="xs:block lg:flex">
<div className="bg-gray-100 relative xs:left-[0px] lg:left-[30px] xs:top-[-35px] lg:top-0 col-span-2 z-0 rounded-3xl xs:pr-5 lg:pr-[55px] xs:pt-[55px] lg:pt-0 pl-5 xs:pb-4">
{/* <div className="xs:block lg:flex">
<h2 className="font-bold xs:text-2xl lg:text-3xl">
لوازم بهداشتی وسمه
</h2>
@ -28,66 +30,82 @@ const BetweenSexualSection = () => {
<p className="px-3 py-1 mb-0 rounded-full w-fit bg-sky-200 xs:mr-0 lg:mr-2 xs:mt-2 lg:mt-0 xs:text-sm lg:text-base ">
به صرفه زیبا شـــــــــــــو
</p>
</div> */}
<div className="grid xs:grid-cols-1 lg:grid-cols-3 gap-5 mt-5 ">
<div className="bg-white p-1 rounded-3xl">
<Link
href={
"/categories/fac3ee2d-19dd-4229-a412-28a1d09cc948/شامپو-بدن"
}
>
<div>
<Image src={w1} className=" rounded-3xl" />
</div>
<div className="text-center p-4">
<p className="mb-0 text-base font-bold">
شامپو بدن بانوان{" "}
</p>
<div className="flex justify-center mt-2">
<p className="mb-0 bg-primary-500 rounded-3xl px-2 text-sm text-white">
تصمین بهترین قیمت
</p>
</div>
</div>
</Link>
</div>
<div className="bg-white p-1 rounded-3xl">
<Link
href={
"/categories/f3e79ed0-d608-470d-8656-7a98ff933c1e/نرم-کننده-مو"
}
>
<div>
<Image src={w2} className=" rounded-3xl" />
</div>
<div className="text-center p-4">
<p className="mb-0 text-base font-bold">نرم کننده مو </p>
<div className="flex justify-center mt-2">
<p className="mb-0 bg-primary-500 rounded-3xl px-2 text-sm text-white">
تصمین بهترین قیمت
</p>
</div>
</div>
</Link>
</div>
<div className="bg-white p-1 rounded-3xl">
<Link
href={
"/categories/8bf20569-c3e3-457f-b9ad-140ef449741b/ژل-بهداشتی-بانوان-و-آقایان"
}
>
<div>
<Image src={w3} className=" rounded-3xl" />
</div>
<div className="text-center p-3 pb-4">
<p className="mb-0 text-base font-bold">
ژل بهداشتی بانوان و آقایان{" "}
</p>
<div className="flex justify-center mt-2">
<p className="mb-0 bg-primary-500 rounded-3xl px-2 text-sm text-white">
تصمین بهترین قیمت
</p>
</div>
</div>
</Link>
</div>
</div>
{/* <p className="mt-3 mb-0 text-sm text-gray-500">
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با
استفاده از طراحان گرافیک است
</p> */}
<div className="mt-10 xs:block lg:flex">
<Link
href={`/categories/8bf20569-c3e3-457f-b9ad-140ef449741b/ژل-بهداشتی-بانوان-و-آقایان`}
className="w-full mx-3"
>
<div className="w-full p-3 mx-1 bg-pink-300 rounded-3xl lg:my-0 ">
<div className="flex justify-end ">
<div className="absolute mt-[-43px] ">
<div className="xs:w-[140px] lg:w-[150px]">
<Image
src={between1}
className=" object-cover xs:w-[140px] lg:w-[150px]"
alt="لوازم بهداشت بانوان وسمه"
/>
</div>
</div>
</div>
<h3 className="xs:text-lg lg:text-xl ">
بهداشت روزانه بانوان
</h3>
<p className="px-3 py-1 mt-2 mb-0 text-sm rounded-full w-fit bg-sky-200">
شروع خرید{" "}
</p>
</div>
</Link>
<Link
href={`/categories/70cffd9e-f475-4245-87bb-5f175d286901/لوازم-اصلاح`}
className="w-full mx-3"
>
<div className="w-full p-3 mx-1 bg-sky-300 rounded-3xl xs:my-3 lg:my-0 ">
<div className="flex justify-end">
<div className="absolute mt-[-43px]">
<div className="xs:w-[140px] lg:w-[150px]">
<Image
src={between2}
className="object-cover "
alt="لوازم بهداشت آقایان وسمه"
/>
</div>
</div>
</div>
<h3 className="xs:text-lg lg:text-xl ">
بهداشت روزانه آقایان
</h3>
<p className="px-3 py-1 mt-2 mb-0 text-sm rounded-full w-fit bg-sky-200">
شروع خرید{" "}
</p>
</div>
</Link>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,80 @@
import CardNormal from "@comp/Cards/CardNormal/page";
import Link from "next/link";
import { Swiper, SwiperSlide } from "swiper/react";
const SunCreamSection = ({ data }) => {
return (
<section className="mb-10 pb-10 xs:bg-sky-500 lg:bg-transparent xs:mx-3 lg:mx-0 xs:px-5 lg:px-0 xs:rounded-3xl lg:rounded-[0px] xs:mt-0 lg:mt-20">
<div className=" relative xs:hidden lg:block ">
<div className="w-full flex justify-end absolute ">
<svg
width="700"
height="400"
viewBox="0 0 1037 590"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="mr-[20px]"
>
<path
d="M25.6693 0H1012C1025.81 0 1037 11.1929 1037 25V565C1037 578.807 1025.81 590 1012 590H371.096C362.569 590 354.631 585.654 350.036 578.472L4.60942 38.4715C-6.03513 21.8311 5.91551 0 25.6693 0Z"
fill="#219EBC"
/>
</svg>
</div>
</div>
<div className="xs:px-0 lg:px-20">
<div className="w-full rtl relative ">
<div className="pt-5 flex relative justify-between">
<h2 className="mb-0 text-white font-bold xs:text-sm lg:text-2xl xl:text-2xl">
کرم ضد آفتاب{" "}
</h2>
</div>
</div>
<Swiper
spaceBetween={50}
slidesPerView={6.2}
// onSlideChange={() => console.log("slide change")}
className="rtl relative mt-5"
// dir="rtl"
breakpoints={{
320: {
slidesPerView: 1.3,
},
480: {
slidesPerView: 2,
},
768: {
slidesPerView: 3,
},
1024: {
slidesPerView: 4.5,
},
1440: {
slidesPerView: 6,
},
}}
>
{data?.map((e, index) => (
<SwiperSlide key={index}>
<CardNormal data={e} priority />
</SwiperSlide>
))}
</Swiper>
<Link
href={"/categories/df80c111-087f-4b2d-bc32-c44d660e76f2/ضد-آفتاب"}
className="z-90 relative"
>
<div className="mx-5 mt-8">
<p className="mb-0 text-sm text-gray-600 xs:text-white md:text-black">
مشاهده بیشتر{" "}
</p>
</div>
</Link>
</div>
</section>
);
};
export default SunCreamSection;

View File

@ -1,42 +1,44 @@
import axios from "axios";
export const getToken = () => {
return localStorage.token;
return localStorage.getItem("token");
};
const Chapar = axios.create({
baseURL: process.env.NEXT_PUBLIC_API_URL,
timeout: 10000,
headers: {
common: {
"Content-type": "application/json",
"Access-Control-Allow-Origin": "*",
...(typeof window !== "undefined" &&
localStorage.token && {
Authorization: getToken(),
}),
},
"Content-type": "application/json",
"Access-Control-Allow-Origin": "*",
},
});
Chapar.interceptors.response.use(
function (response) {
// Any status code that lie within the range of 2xx cause this function to trigger
// Do something with response data
// Request interceptor to conditionally add token to headers
Chapar.interceptors.request.use(
(config) => {
const token = getToken();
if (token && !config.isPublic) {
config.headers.Authorization = token;
}
return config;
},
(error) => {
return Promise.reject(error);
}
);
// Response interceptor to handle responses
Chapar.interceptors.response.use(
(response) => {
return response.data;
},
function (error, status) {
// Any status codes that falls outside the range of 2xx cause this function to trigger
// Do something with response error
// ;
// if (error.response.status === 401) {
// localStorage.removeItem("token");
// window.location.href = "/login";
// }
return Promise.reject({ error, status: error?.response?.status });
(error) => {
const status = error?.response?.status;
if (status === 401) {
localStorage.removeItem("token");
window.location.href = "/login";
}
return Promise.reject({ error, status });
}
);

View File

@ -1,6 +1,7 @@
"use client";
import AppContext from "@ctx/AppContext";
import Chapar from "plugins/Chapar";
import { useContext } from "react";
import { BottomSheet } from "react-spring-bottom-sheet";
import { toast } from "react-toastify";
@ -9,11 +10,13 @@ const BottomSheetDeleteAddress = ({ id }) => {
const CTX = useContext(AppContext);
const cart = CTX.state.cart;
const handleDelete = async (id) => {
const handleDelete = async () => {
try {
const data = await Chapar.post(
const data = await Chapar.delete(
`${process.env.NEXT_PUBLIC_API_URL}/user/address/${id}`
);
CTX.setBottomSheetDeleteAddressOpen(false);
CTX.fetchAddressUser();
} catch ({ error, status }) {
toast.error(`${error?.response?.data?.message}`, {
position: "bottom-right",

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -5,6 +5,7 @@ import BetweenSexualSection from "@comp/LandingPage/BetweenSexualSection/page";
import BrandsLogoSection from "@comp/LandingPage/BrandsLogoSection/page";
import HeroSection from "@comp/LandingPage/HeroSection/page";
import HomeSection from "@comp/LandingPage/HomeSection/page";
import SunCreamSection from "@comp/LandingPage/SunCreamSection/page";
import SurpriseSection from "@comp/LandingPage/SurpriseSection/page";
import Navbar from "@comp/Navbar/page";
import AppContext from "@ctx/AppContext";
@ -17,11 +18,13 @@ export default function Page() {
const specialOfferData = CTX.state.specialOfferData;
const cosmeticData = CTX.state.cosmeticData;
const HomeCosmeticData = CTX.state.HomeCosmeticData;
const sunCreamData = CTX.state.sunCreamData;
useEffect(() => {
CTX.fetchSpecialOffer();
CTX.fetchCosmetic();
CTX.fetchHomeCosmetic();
CTX.fetchSunCream();
}, []);
return (
<>
@ -36,6 +39,7 @@ export default function Page() {
<SurpriseSection data={specialOfferData?.products} />
<BetweenSexualSection />
<SunCreamSection data={sunCreamData?.products} />
<BrandsLogoSection />
<BeautySection data={cosmeticData?.products} />

View File

@ -3,13 +3,15 @@
import Navbar from "@comp/Navbar/page";
import AppContext from "@ctx/AppContext";
import BottomSheetDeleteAddress from "plugins/bottomSheet/BottomSheetDeleteAddress";
import { useContext, useEffect } from "react";
import { useContext, useEffect, useState } from "react";
import SideBarProfile from "../component/SideBarProfile/page";
const Page = () => {
const CTX = useContext(AppContext);
const addressData = CTX.state.addressData;
const [currentAddressId, setCurrentAddressId] = useState();
useEffect(() => {
if (addressData.length <= 0) {
CTX.fetchAddressUser();
@ -63,9 +65,10 @@ const Page = () => {
<td className="px-4 py-3 font-semibold text-center">
<button
className="btn bg-red-500 text-white !py-1 rounded-xl text-sm font-normal"
onClick={() =>
CTX.setBottomSheetDeleteAddressOpen(true)
}
onClick={() => {
CTX.setBottomSheetDeleteAddressOpen(true);
setCurrentAddressId(e.id);
}}
>
حذف{" "}
</button>{" "}
@ -85,7 +88,7 @@ const Page = () => {
</div>
</div>
</div>
<BottomSheetDeleteAddress />
<BottomSheetDeleteAddress id={currentAddressId} />
</>
);
};

View File

@ -5,25 +5,5 @@ async function getData(id) {
}
export default async function Sitemap() {
const localUrl = [
{
url: "https://acme.com",
lastModified: new Date(),
changeFrequency: "yearly",
priority: 1,
},
{
url: "https://acme.com/about",
lastModified: new Date(),
changeFrequency: "monthly",
priority: 0.8,
},
{
url: "https://acme.com/blog",
lastModified: new Date(),
changeFrequency: "weekly",
priority: 0.5,
},
];
return (await getData()).concat(localUrl);
return await getData();
}