add Cart model + add store fot save all methods
This commit is contained in:
@@ -10,13 +10,9 @@ import { useCart } from '../hook/useCart';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useGetProfile } from '@/app/[name]/(Profile)/profile/hooks/userProfileData';
|
||||
import { useGetCartItems } from '../hooks/useCartData';
|
||||
import { useCartStore } from '../store/Store';
|
||||
|
||||
interface CartSummaryProps {
|
||||
description?: string;
|
||||
onDescriptionChange?: (value: string) => void;
|
||||
}
|
||||
|
||||
const CartSummary = ({ description = '', onDescriptionChange }: CartSummaryProps) => {
|
||||
const CartSummary = () => {
|
||||
const params = useParams();
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
@@ -27,6 +23,7 @@ const CartSummary = ({ description = '', onDescriptionChange }: CartSummaryProps
|
||||
const { items } = useCart();
|
||||
const { data: cartData } = useGetCartItems(isSuccess);
|
||||
const { t } = useTranslation('parallels', { keyPrefix: 'Cart' });
|
||||
const { description, setDescription } = useCartStore();
|
||||
|
||||
const cartFoods = React.useMemo(() => {
|
||||
if (!foods.length) return [];
|
||||
@@ -72,7 +69,7 @@ const CartSummary = ({ description = '', onDescriptionChange }: CartSummaryProps
|
||||
id='description'
|
||||
name='description'
|
||||
value={description}
|
||||
onChange={(e) => onDescriptionChange?.(e.target.value)}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
></textarea>
|
||||
<span className='absolute top-4 right-2 px-2 bg-background text-foreground text-xs'></span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user