favorite
This commit is contained in:
@@ -4,7 +4,7 @@ import { CartQuantityControl } from '@/components/CartQuantityControl'
|
|||||||
import { ef } from '@/lib/helpers/utfNumbers'
|
import { ef } from '@/lib/helpers/utfNumbers'
|
||||||
import { useCart } from '@/app/[name]/(Dialogs)/cart/hook/useCart'
|
import { useCart } from '@/app/[name]/(Dialogs)/cart/hook/useCart'
|
||||||
import { getPrimaryVariantId } from '@/app/[name]/(Main)/types/Types'
|
import { getPrimaryVariantId } from '@/app/[name]/(Main)/types/Types'
|
||||||
import { ArrowLeft, Clock, Cup, Heart, TruckTick } from 'iconsax-react'
|
import { ArrowLeft, Cup, Heart, TruckTick } from 'iconsax-react'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { useParams, useRouter } from 'next/navigation'
|
import { useParams, useRouter } from 'next/navigation'
|
||||||
import React, { useEffect, useMemo, useState } from 'react'
|
import React, { useEffect, useMemo, useState } from 'react'
|
||||||
@@ -131,7 +131,7 @@ function ProductPage({ }: Props) {
|
|||||||
const price = hasVariants
|
const price = hasVariants
|
||||||
? (selectedVariant?.price ?? 0)
|
? (selectedVariant?.price ?? 0)
|
||||||
: (productData.price ?? selectedVariant?.price ?? 0);
|
: (productData.price ?? selectedVariant?.price ?? 0);
|
||||||
const prepareTime = productData.prepareTime || 0;
|
// const prepareTime = productData.prepareTime || 0;
|
||||||
const content = Array.isArray(productData.content)
|
const content = Array.isArray(productData.content)
|
||||||
? productData.content.join('، ')
|
? productData.content.join('، ')
|
||||||
: productData.content || productData.desc || '';
|
: productData.content || productData.desc || '';
|
||||||
@@ -187,12 +187,12 @@ function ProductPage({ }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-4 text-xs">
|
<div className="mt-4 text-xs">
|
||||||
<div className='flex items-center gap-1'>
|
{/* <div className='flex items-center gap-1'>
|
||||||
<Clock size={14} className='stroke-disabled-text' />
|
<Clock size={14} className='stroke-disabled-text' />
|
||||||
<span className='text-disabled-text'>
|
<span className='text-disabled-text'>
|
||||||
زمان پخت و آماده سازی: {prepareTime > 0 ? `${ef(String(prepareTime))} دقیقه` : '-'}
|
زمان پخت و آماده سازی: {prepareTime > 0 ? `${ef(String(prepareTime))} دقیقه` : '-'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div> */}
|
||||||
<div className='flex items-center gap-2 mt-2'>
|
<div className='flex items-center gap-2 mt-2'>
|
||||||
<Cup size={14} className='stroke-disabled-text' />
|
<Cup size={14} className='stroke-disabled-text' />
|
||||||
<span className='text-disabled-text flex gap-1'>
|
<span className='text-disabled-text flex gap-1'>
|
||||||
@@ -240,11 +240,10 @@ function ProductPage({ }: Props) {
|
|||||||
key={variant.id}
|
key={variant.id}
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setSelectedVariantId(variant.id)}
|
onClick={() => setSelectedVariantId(variant.id)}
|
||||||
className={`px-3 py-1 rounded-full border text-xs ${
|
className={`px-3 py-1 rounded-full border text-xs ${variant.id === selectedVariant?.id
|
||||||
variant.id === selectedVariant?.id
|
? 'bg-primary text-white border-primary'
|
||||||
? 'bg-primary text-white border-primary'
|
: 'bg-background text-foreground border-border'
|
||||||
: 'bg-background text-foreground border-border'
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{variant.value}
|
{variant.value}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ export const getProduct = async (id: string): Promise<ProductResponse> => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const toggleFavorite = async (productId: string) => {
|
export const toggleFavorite = async (productId: string) => {
|
||||||
const { data } = await api.post(`/public/products/favorite/${productId}`);
|
const { data } = await api.post(`/public/products/${productId}/favorite`);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ function FavoritePage() {
|
|||||||
desc: favProduct.desc,
|
desc: favProduct.desc,
|
||||||
content: favProduct.content,
|
content: favProduct.content,
|
||||||
price: favProduct.price,
|
price: favProduct.price,
|
||||||
order: favProduct.order,
|
order: favProduct.order || 0,
|
||||||
isActive: favProduct.isActive,
|
isActive: favProduct.isActive,
|
||||||
images: favProduct.images,
|
images: favProduct.images,
|
||||||
inPlaceServe: favProduct.inPlaceServe,
|
inPlaceServe: favProduct.inPlaceServe,
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
// export const API_BASE_URL = "https://dmenuplus-api.dev.danakcorp.com";
|
// export const API_BASE_URL = "https://dmenuplus-api.dev.danakcorp.com";
|
||||||
// export const API_BASE_URL = "https://dkala-api.danakcorp.com";
|
// export const API_BASE_URL = "https://dkala-api.danakcorp.com";
|
||||||
export const API_BASE_URL = "http://192.168.99.209:4000";
|
export const API_BASE_URL = "http://10.191.241.88:4000";
|
||||||
export const TOKEN_NAME = "dmenu-t";
|
export const TOKEN_NAME = "dkala-t";
|
||||||
export const REFRESH_TOKEN_NAME = "dmenu-rt";
|
export const REFRESH_TOKEN_NAME = "dkala-rt";
|
||||||
|
|||||||
Reference in New Issue
Block a user