error order update
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
ZoomControl,
|
||||
} from '@pbe/react-yandex-maps';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { AxiosError } from 'axios';
|
||||
import {
|
||||
CheckCircle2,
|
||||
Clock,
|
||||
@@ -84,11 +85,14 @@ const OrderPage = () => {
|
||||
setCart(cart_id);
|
||||
queryClinet.refetchQueries({ queryKey: ['cart_items'] });
|
||||
},
|
||||
onError: () => {
|
||||
toast.error('Xatolik yuz berdi', {
|
||||
richColors: true,
|
||||
position: 'top-center',
|
||||
});
|
||||
onError: (error: AxiosError) => {
|
||||
(
|
||||
error.response?.data as { items: { non_field_errors: string[] }[] }
|
||||
).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
|
||||
{...field}
|
||||
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>
|
||||
<FormMessage />
|
||||
|
||||
Reference in New Issue
Block a user