diff --git a/src/features/auth/ui/Login.tsx b/src/features/auth/ui/Login.tsx index bb6c28c..70fea41 100644 --- a/src/features/auth/ui/Login.tsx +++ b/src/features/auth/ui/Login.tsx @@ -45,8 +45,7 @@ const Login = () => { setRefToken(res.data.refresh); setUser(form.getValues('username')); router.push('/'); - queryClient.refetchQueries({ queryKey: ['product_list'] }); - queryClient.refetchQueries({ queryKey: ['get_me'] }); + queryClient.refetchQueries(); }, onError: () => { toast.error(t('Username yoki parol xato kiritildi'), { diff --git a/src/features/cart/ui/CartPage.tsx b/src/features/cart/ui/CartPage.tsx index 0281f83..35573d5 100644 --- a/src/features/cart/ui/CartPage.tsx +++ b/src/features/cart/ui/CartPage.tsx @@ -125,7 +125,7 @@ const CartPage = () => { const subtotal = cartItems.reduce((sum, item) => { if (!item.product.prices.length) return sum; - const maxPrice = Math.max( + const maxPrice = Math.min( ...item.product.prices.map((p) => Number(p.price)), ); return sum + maxPrice * (quantities[item.id] || item.quantity); @@ -228,7 +228,7 @@ const CartPage = () => {
{formatPrice( item.product.prices.length !== 0 - ? Math.max( + ? Math.min( ...item.product.prices.map((p) => Number(p.price), ), diff --git a/src/features/product/ui/Product.tsx b/src/features/product/ui/Product.tsx index 233f756..12eae77 100644 --- a/src/features/product/ui/Product.tsx +++ b/src/features/product/ui/Product.tsx @@ -200,7 +200,7 @@ const ProductDetail = () => { setQuantity((q) => { let next = q - STEP; if (isGram) next = Math.floor(next / STEP) * STEP; - return Math.max(MIN_QTY, next); + return Math.min(MIN_QTY, next); }); }; diff --git a/src/features/profile/ui/Profile.tsx b/src/features/profile/ui/Profile.tsx index 1c8bb53..1dc70a8 100644 --- a/src/features/profile/ui/Profile.tsx +++ b/src/features/profile/ui/Profile.tsx @@ -115,10 +115,7 @@ const Profile = () => {