Convert notices if they are present on error response
This commit is contained in:
parent
f750fb5238
commit
c5304aecac
|
@ -13,6 +13,11 @@ import {
|
|||
} from '@woocommerce/types';
|
||||
import { noticeContexts } from '@woocommerce/base-context/event-emit/utils';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { processNotices } from './process-notices';
|
||||
|
||||
type ApiParamError = {
|
||||
param: string;
|
||||
id: string;
|
||||
|
@ -195,6 +200,10 @@ export const processErrorResponse = (
|
|||
return;
|
||||
}
|
||||
|
||||
if ( response.data?.notices ) {
|
||||
processNotices( response.data?.notices );
|
||||
}
|
||||
|
||||
if ( response.code === 'rest_invalid_param' ) {
|
||||
return processInvalidParamResponse( response, context );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue