error order update
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
|||||||
ZoomControl,
|
ZoomControl,
|
||||||
} from '@pbe/react-yandex-maps';
|
} from '@pbe/react-yandex-maps';
|
||||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { AxiosError } from 'axios';
|
||||||
import {
|
import {
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
Clock,
|
Clock,
|
||||||
@@ -84,11 +85,14 @@ const OrderPage = () => {
|
|||||||
setCart(cart_id);
|
setCart(cart_id);
|
||||||
queryClinet.refetchQueries({ queryKey: ['cart_items'] });
|
queryClinet.refetchQueries({ queryKey: ['cart_items'] });
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: (error: AxiosError) => {
|
||||||
toast.error('Xatolik yuz berdi', {
|
(
|
||||||
richColors: true,
|
error.response?.data as { items: { non_field_errors: string[] }[] }
|
||||||
position: 'top-center',
|
).items
|
||||||
});
|
?.flatMap((i) => i.non_field_errors || [])
|
||||||
|
.forEach((msg: string) =>
|
||||||
|
toast.error(msg, { richColors: true, position: 'top-center' }),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -299,7 +303,7 @@ const OrderPage = () => {
|
|||||||
<Input
|
<Input
|
||||||
{...field}
|
{...field}
|
||||||
className="w-full border h-12 border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
className="w-full border h-12 border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:border-blue-500"
|
||||||
placeholder={t('Ism Familiyangiz')}
|
placeholder={t('Familiyangiz')}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ export function CategoryCarousel({ category }: { category: CategoryResult }) {
|
|||||||
: 'bg-green-600/50 cursor-not-allowed',
|
: 'bg-green-600/50 cursor-not-allowed',
|
||||||
)}
|
)}
|
||||||
disabled={!canScrollNext}
|
disabled={!canScrollNext}
|
||||||
|
aria-label="next images"
|
||||||
size="icon"
|
size="icon"
|
||||||
>
|
>
|
||||||
<ChevronRight className="size-6" />
|
<ChevronRight className="size-6" />
|
||||||
@@ -137,6 +138,7 @@ export function CategoryCarousel({ category }: { category: CategoryResult }) {
|
|||||||
? 'bg-green-600 hover:bg-green-600/70'
|
? 'bg-green-600 hover:bg-green-600/70'
|
||||||
: 'bg-green-600/50 cursor-not-allowed',
|
: 'bg-green-600/50 cursor-not-allowed',
|
||||||
)}
|
)}
|
||||||
|
aria-label="prev images"
|
||||||
disabled={!canScrollPrev}
|
disabled={!canScrollPrev}
|
||||||
size="icon"
|
size="icon"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ export function ProductCard({
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
favouriteMutation.mutate(product.id);
|
favouriteMutation.mutate(product.id);
|
||||||
}}
|
}}
|
||||||
|
aria-label="liked"
|
||||||
className="absolute top-2 right-2 z-10 bg-white hover:bg-gray-200 cursor-pointer rounded-full p-1.5 sm:p-2 shadow hover:scale-110"
|
className="absolute top-2 right-2 z-10 bg-white hover:bg-gray-200 cursor-pointer rounded-full p-1.5 sm:p-2 shadow hover:scale-110"
|
||||||
>
|
>
|
||||||
<Heart
|
<Heart
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export function ChangeLang() {
|
|||||||
alt="uz"
|
alt="uz"
|
||||||
width={20}
|
width={20}
|
||||||
height={20}
|
height={20}
|
||||||
className="object-cover"
|
className="object-cover w-full h-full"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Image
|
<Image
|
||||||
@@ -48,7 +48,7 @@ export function ChangeLang() {
|
|||||||
alt="ru"
|
alt="ru"
|
||||||
width={20}
|
width={20}
|
||||||
height={20}
|
height={20}
|
||||||
className="object-cover"
|
className="object-cover w-full h-full"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -144,32 +144,56 @@ const Navbar = () => {
|
|||||||
|
|
||||||
{/* Ijtimoiy tarmoqlar */}
|
{/* Ijtimoiy tarmoqlar */}
|
||||||
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
||||||
<a href={'#'} className="flex items-center gap-2">
|
<a
|
||||||
|
href={'#'}
|
||||||
|
className="flex items-center gap-2"
|
||||||
|
aria-label="telegram"
|
||||||
|
>
|
||||||
<Send className="size-4" />
|
<Send className="size-4" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
||||||
<a href={'#'} className="flex items-center gap-2">
|
<a
|
||||||
|
href={'#'}
|
||||||
|
className="flex items-center gap-2"
|
||||||
|
aria-label="Instagram"
|
||||||
|
>
|
||||||
<Instagram className="size-4" />
|
<Instagram className="size-4" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
||||||
<a href={'#'} className="flex items-center gap-2">
|
<a
|
||||||
|
href={'#'}
|
||||||
|
className="flex items-center gap-2"
|
||||||
|
aria-label="Facebook"
|
||||||
|
>
|
||||||
<Facebook className="size-4" />
|
<Facebook className="size-4" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
||||||
<a href={'#'} className="flex items-center gap-2">
|
<a
|
||||||
|
href={'#'}
|
||||||
|
className="flex items-center gap-2"
|
||||||
|
aria-label="Twitter"
|
||||||
|
>
|
||||||
<Twitter className="size-4" />
|
<Twitter className="size-4" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
||||||
<a href={'#'} className="flex items-center gap-2">
|
<a
|
||||||
|
href={'#'}
|
||||||
|
className="flex items-center gap-2"
|
||||||
|
aria-label="Mail"
|
||||||
|
>
|
||||||
<Mail className="size-4" />
|
<Mail className="size-4" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
<li className="text-white hover:text-white/80 transition-colors cursor-pointer">
|
||||||
<a href={'tel:+998901234567'} className="flex items-center gap-2">
|
<a
|
||||||
|
href={'tel:+998901234567'}
|
||||||
|
className="flex items-center gap-2"
|
||||||
|
aria-label="Phone"
|
||||||
|
>
|
||||||
<Phone className="size-4" />
|
<Phone className="size-4" />
|
||||||
<p>{formatPhone('+998901234567')}</p>
|
<p>{formatPhone('+998901234567')}</p>
|
||||||
</a>
|
</a>
|
||||||
@@ -404,6 +428,7 @@ const Navbar = () => {
|
|||||||
variant={'ghost'}
|
variant={'ghost'}
|
||||||
className="h-10 max-lg:hidden cursor-pointer border border-slate-200"
|
className="h-10 max-lg:hidden cursor-pointer border border-slate-200"
|
||||||
onClick={() => router.push('/favourite')}
|
onClick={() => router.push('/favourite')}
|
||||||
|
aria-label="my favouurite product"
|
||||||
>
|
>
|
||||||
<Heart className="size-4 text-foreground" />
|
<Heart className="size-4 text-foreground" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -427,6 +452,7 @@ const Navbar = () => {
|
|||||||
router.push('/auth');
|
router.push('/auth');
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
aria-label="my account"
|
||||||
className="h-10 max-lg:hidden cursor-pointer border border-slate-200"
|
className="h-10 max-lg:hidden cursor-pointer border border-slate-200"
|
||||||
>
|
>
|
||||||
<User className="size-4 text-foreground" />
|
<User className="size-4 text-foreground" />
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ const Welcome = () => {
|
|||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{isLoading && (
|
{isLoading && (
|
||||||
<CarouselItem className="relative">
|
<CarouselItem className="relative">
|
||||||
<Skeleton className="w-full h-full" />
|
<Skeleton className="w-full h-[200px]" />
|
||||||
</CarouselItem>
|
</CarouselItem>
|
||||||
)}
|
)}
|
||||||
{isError && (
|
{isError && (
|
||||||
@@ -88,11 +88,11 @@ const Welcome = () => {
|
|||||||
className="relative overflow-hidden rounded-2xl"
|
className="relative overflow-hidden rounded-2xl"
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
src={BASE_URL + banner.banner || '/placeholder.svg'}
|
src={BASE_URL + banner.banner}
|
||||||
alt={banner.id}
|
alt={banner.id}
|
||||||
fill
|
width={900}
|
||||||
className="object-cover"
|
height={900}
|
||||||
priority={index === 0}
|
className="object-cover w-full h-full"
|
||||||
/>
|
/>
|
||||||
</AspectRatio>
|
</AspectRatio>
|
||||||
<Button
|
<Button
|
||||||
@@ -100,6 +100,7 @@ const Welcome = () => {
|
|||||||
className="absolute max-lg:w-6 max-lg:h-6 top-1/2 -translate-y-1/2 right-2 cursor-pointer"
|
className="absolute max-lg:w-6 max-lg:h-6 top-1/2 -translate-y-1/2 right-2 cursor-pointer"
|
||||||
variant={'secondary'}
|
variant={'secondary'}
|
||||||
size={'icon'}
|
size={'icon'}
|
||||||
|
aria-label="next images"
|
||||||
>
|
>
|
||||||
<ChevronRight className="size-6 max-lg:size-5" />
|
<ChevronRight className="size-6 max-lg:size-5" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -108,6 +109,7 @@ const Welcome = () => {
|
|||||||
className="absolute max-lg:w-6 max-lg:h-6 top-1/2 -translate-y-1/2 left-5 cursor-pointer"
|
className="absolute max-lg:w-6 max-lg:h-6 top-1/2 -translate-y-1/2 left-5 cursor-pointer"
|
||||||
variant={'secondary'}
|
variant={'secondary'}
|
||||||
size={'icon'}
|
size={'icon'}
|
||||||
|
aria-label="prev images"
|
||||||
>
|
>
|
||||||
<ChevronLeft className="size-6 max-lg:size-5" />
|
<ChevronLeft className="size-6 max-lg:size-5" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -146,6 +148,7 @@ const Welcome = () => {
|
|||||||
className="absolute max-lg:w-8 max-lg:h-8 top-1/2 -translate-y-1/2 -right-2 cursor-pointer"
|
className="absolute max-lg:w-8 max-lg:h-8 top-1/2 -translate-y-1/2 -right-2 cursor-pointer"
|
||||||
variant={'secondary'}
|
variant={'secondary'}
|
||||||
size={'icon'}
|
size={'icon'}
|
||||||
|
aria-label="next images"
|
||||||
>
|
>
|
||||||
<ChevronRight className="size-6 max-lg:size-6" />
|
<ChevronRight className="size-6 max-lg:size-6" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -154,6 +157,7 @@ const Welcome = () => {
|
|||||||
className="absolute max-lg:w-8 max-lg:h-8 top-1/2 -translate-y-1/2 -left-2 cursor-pointer"
|
className="absolute max-lg:w-8 max-lg:h-8 top-1/2 -translate-y-1/2 -left-2 cursor-pointer"
|
||||||
variant={'secondary'}
|
variant={'secondary'}
|
||||||
size={'icon'}
|
size={'icon'}
|
||||||
|
aria-label="prev images"
|
||||||
>
|
>
|
||||||
<ChevronLeft className="size-6 max-lg:size-6" />
|
<ChevronLeft className="size-6 max-lg:size-6" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user