@@ -19,6 +19,7 @@ import { FC, ReactNode } from "react";
1919import { useForm } from "react-hook-form" ;
2020import { isNullish } from "remeda" ;
2121
22+ import { formatBackendErrorMessage } from "@frontend/shop/apis" ;
2223import { OrderProductRelationOptionInput , PriceDisplay , SignInGuard } from "@frontend/shop/components/common" ;
2324import {
2425 useOneItemRefundMutation ,
@@ -113,7 +114,7 @@ const OrderProductRelationItem: FC<OrderProductRelationItemProps> = ({
113114 { order_id : order . id , order_product_relation_id : prodRel . id } ,
114115 {
115116 onSuccess : ( ) => addSnackbar ( succeededToRefundOrderStr , "success" ) ,
116- onError : ( ) => addSnackbar ( failedToRefundOrderStr , "error" ) ,
117+ onError : ( error ) => addSnackbar ( formatBackendErrorMessage ( error , failedToRefundOrderStr ) , "error" ) ,
117118 }
118119 ) ;
119120 const patchOneItemOptions = ( ) => {
@@ -139,7 +140,7 @@ const OrderProductRelationItem: FC<OrderProductRelationItemProps> = ({
139140 } ,
140141 {
141142 onSuccess : ( ) => addSnackbar ( succeededToPatchOptionsStr , "success" ) ,
142- onError : ( ) => addSnackbar ( failedToPatchOptionsStr , "error" ) ,
143+ onError : ( error ) => addSnackbar ( formatBackendErrorMessage ( error , failedToPatchOptionsStr ) , "error" ) ,
143144 }
144145 ) ;
145146 } ;
@@ -211,7 +212,7 @@ const OrderItem: FC<OrderItemProps> = ({ order, disabled, ...props }) => {
211212 { order_id : order . id } ,
212213 {
213214 onSuccess : ( ) => addSnackbar ( succeededToRefundFullOrderStr , "success" ) ,
214- onError : ( ) => addSnackbar ( failedToRefundFullOrderStr , "error" ) ,
215+ onError : ( error ) => addSnackbar ( formatBackendErrorMessage ( error , failedToRefundFullOrderStr ) , "error" ) ,
215216 }
216217 ) ;
217218 const openReceipt = ( ) => window . open ( `${ backendApiDomain } /v1/shop/orders/${ order . id } /receipt/` , "_blank" ) ;
0 commit comments