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';
|
} from '@woocommerce/types';
|
||||||
import { noticeContexts } from '@woocommerce/base-context/event-emit/utils';
|
import { noticeContexts } from '@woocommerce/base-context/event-emit/utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import { processNotices } from './process-notices';
|
||||||
|
|
||||||
type ApiParamError = {
|
type ApiParamError = {
|
||||||
param: string;
|
param: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -195,6 +200,10 @@ export const processErrorResponse = (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( response.data?.notices ) {
|
||||||
|
processNotices( response.data?.notices );
|
||||||
|
}
|
||||||
|
|
||||||
if ( response.code === 'rest_invalid_param' ) {
|
if ( response.code === 'rest_invalid_param' ) {
|
||||||
return processInvalidParamResponse( response, context );
|
return processInvalidParamResponse( response, context );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue