fix: use getApiErrorMessage in CheckoutPage for user-friendly error display
This commit is contained in:
@@ -21,6 +21,7 @@ import { createOrder } from '@/entities/order/api/order-api'
|
|||||||
import { fetchMyAddresses } from '@/entities/user/api/address-api'
|
import { fetchMyAddresses } from '@/entities/user/api/address-api'
|
||||||
import { DELIVERY_CARRIER_OPTIONS, type DeliveryCarrierCode } from '@/shared/constants/delivery-carrier'
|
import { DELIVERY_CARRIER_OPTIONS, type DeliveryCarrierCode } from '@/shared/constants/delivery-carrier'
|
||||||
import { formatPriceRub } from '@/shared/lib/format-price'
|
import { formatPriceRub } from '@/shared/lib/format-price'
|
||||||
|
import { getApiErrorMessage } from '@/shared/lib/get-api-error-message'
|
||||||
import { $user } from '@/shared/model/auth'
|
import { $user } from '@/shared/model/auth'
|
||||||
|
|
||||||
export function CheckoutPage() {
|
export function CheckoutPage() {
|
||||||
@@ -263,7 +264,7 @@ export function CheckoutPage() {
|
|||||||
Создать заказ
|
Создать заказ
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{createMut.isError && <Alert severity="error">{(createMut.error as Error).message}</Alert>}
|
{createMut.isError && <Alert severity="error">{getApiErrorMessage(createMut.error)}</Alert>}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user