diff --git a/src/features/auth/ui/Login.tsx b/src/features/auth/ui/Login.tsx
index 70fea41..b4ec6fa 100644
--- a/src/features/auth/ui/Login.tsx
+++ b/src/features/auth/ui/Login.tsx
@@ -1,7 +1,7 @@
'use client';
import { Link, useRouter } from '@/shared/config/i18n/navigation';
-import { setRefToken, setToken, setUser } from '@/shared/lib/token';
+import { setRefToken, setToken } from '@/shared/lib/token';
import { Button } from '@/shared/ui/button';
import {
Form,
@@ -41,11 +41,11 @@ const Login = () => {
tg_id?: string;
}) => auth_api.login(body),
onSuccess: (res) => {
+ router.push('/');
+ queryClient.refetchQueries({ queryKey: ['all_products'] });
+ queryClient.refetchQueries({ queryKey: ['list'] });
setToken(res.data.access);
setRefToken(res.data.refresh);
- setUser(form.getValues('username'));
- router.push('/');
- queryClient.refetchQueries();
},
onError: () => {
toast.error(t('Username yoki parol xato kiritildi'), {
diff --git a/src/features/cart/ui/OrderPage.tsx b/src/features/cart/ui/OrderPage.tsx
index c1e4651..6587512 100644
--- a/src/features/cart/ui/OrderPage.tsx
+++ b/src/features/cart/ui/OrderPage.tsx
@@ -63,12 +63,10 @@ interface CoordsData {
// Yetkazib berish vaqt oraliqlar
const deliveryTimeSlots = [
- { id: 1, label: '09:00 - 11:00', start: '09:00', end: '11:00' },
- { id: 2, label: '11:00 - 13:00', start: '11:00', end: '13:00' },
- { id: 3, label: '13:00 - 15:00', start: '13:00', end: '15:00' },
- { id: 4, label: '15:00 - 17:00', start: '15:00', end: '17:00' },
- { id: 5, label: '17:00 - 19:00', start: '17:00', end: '19:00' },
- { id: 6, label: '19:00 - 21:00', start: '19:00', end: '21:00' },
+ { id: 1, label: '10:00 - 12:00', start: '10:00', end: '12:00' },
+ { id: 2, label: '12:00 - 14:00', start: '12:00', end: '14:00' },
+ { id: 3, label: '14:00 - 16:00', start: '14:00', end: '16:00' },
+ { id: 4, label: '16:00 - 18:00', start: '16:00', end: '18:00' },
];
const OrderPage = () => {
diff --git a/src/features/profile/ui/History.tsx b/src/features/profile/ui/History.tsx
index b4acb8e..943a999 100644
--- a/src/features/profile/ui/History.tsx
+++ b/src/features/profile/ui/History.tsx
@@ -16,27 +16,18 @@ import {
} from 'lucide-react';
import { useTranslations } from 'next-intl';
import Image from 'next/image';
-import { useSearchParams } from 'next/navigation';
-import { useEffect, useState } from 'react';
import { order_api, OrderList } from '../lib/api';
const HistoryTabs = () => {
const t = useTranslations();
- const searchParams = useSearchParams();
- const [page, setPage] = useState(1);
const router = useRouter();
const { data, isLoading } = useQuery({
- queryKey: ['order_list', page],
+ queryKey: ['order_list'],
queryFn: () => order_api.list(),
select: (res) => res.data,
});
- useEffect(() => {
- const urlPage = Number(searchParams.get('page')) || 1;
- setPage(urlPage);
- }, [searchParams]);
-
if (isLoading) {
return (
@@ -47,7 +38,7 @@ const HistoryTabs = () => {
if (!data || data.length === 0) {
return (
-
+
@@ -68,9 +59,9 @@ const HistoryTabs = () => {
}
return (
-
+
{/* Header */}
-
+
{t('Buyurtmalar tarixi')}
@@ -82,8 +73,8 @@ const HistoryTabs = () => {
{/* Orders List */}
-
- {data?.map((order: OrderList) => {
+
+ {data.map((order: OrderList) => {
const totalPrice = order.items.reduce(
(sum, item) => sum + Number(item.price) * item.quantity,
0,
@@ -96,7 +87,7 @@ const HistoryTabs = () => {
>
{/* Order Header */}
-
+
@@ -143,11 +134,10 @@ const HistoryTabs = () => {
{/* Products */}
-
- {order?.items?.map((item, index) => {
+
+ {order.items.map((item, index) => {
const product = item.product;
- // Get product image
const productImage = product.images?.[0]?.images
? product.images[0].images.includes(BASE_URL)
? product.images[0].images
@@ -157,13 +147,12 @@ const HistoryTabs = () => {
return (
- {/* Product Header with Image */}
-
- {/* Product Image */}
+
+ {/* Image */}
-
- {/* Product Info */}
+ {/* Info */}
-
-
-
+
+
+
{index + 1}
-
+
{product.name}
+
{product.short_name && (
-
+
{product.short_name}
)}
-
-
+
+
+
{t('Mahsulotlar narxi')}
-
+
{formatPrice(Number(item.price), true)}
-
-
- {/* Product Details Grid */}
-
-
-
- {t('Miqdor')}
-
-
- {item?.quantity}
-
-
-
-
- {t('Jami')}
-
-
- {formatPrice(
- Number(item.price) * item.quantity,
- true,
- )}
-
+ {/* Details */}
+
+
+
+ {t('Miqdor')}
+
+
+ {item.quantity}
+
+
+
+
+
+ {t('Jami')}
+
+
+ {formatPrice(
+ Number(item.price) * item.quantity,
+ true,
+ )}
+
+
+
@@ -232,54 +224,45 @@ const HistoryTabs = () => {
})}
- {/* Order Footer */}
-
- {/* Price Breakdown */}
-
-
+ {/* Footer */}
+
+
+
{t('Mahsulotlar narxi')}:
{formatPrice(totalPrice, true)}
-
+
+
{t('Mahsulotlar soni')}:
{order.items.reduce(
(sum, item) => sum + item.quantity,
0,
- )}
+ )}{' '}
{t('dona')}
-
-
-
- {t('Umumiy summa')}:
-
-
- {formatPrice(totalPrice, true)}
-
-
+
+
+ {t('Umumiy summa')}:
+
+ {formatPrice(totalPrice, true)}
+
-
- {/* Actions */}
-
-
-
-
+
diff --git a/src/features/profile/ui/Profile.tsx b/src/features/profile/ui/Profile.tsx
index a3853b6..ea90984 100644
--- a/src/features/profile/ui/Profile.tsx
+++ b/src/features/profile/ui/Profile.tsx
@@ -115,11 +115,11 @@ const Profile = () => {