Add WCNotice and WCNoticeList types
This commit is contained in:
parent
68065a8c11
commit
f750fb5238
|
@ -3,6 +3,19 @@
|
|||
*/
|
||||
import type { CartResponse } from './cart-response';
|
||||
|
||||
// The notice added from wc_get_notices contains only the notice text an any additional data.
|
||||
export interface WCNotice {
|
||||
data?: Record< string, string >;
|
||||
notice?: string;
|
||||
}
|
||||
|
||||
// The array of notices returned from wc_get_notices contains three members, one for each type of notice.
|
||||
export interface WCNoticeList {
|
||||
notice?: WCNotice[];
|
||||
error?: WCNotice[];
|
||||
success?: WCNotice[];
|
||||
}
|
||||
|
||||
// This is the standard API response data when an error is returned.
|
||||
export type ApiErrorResponse = {
|
||||
code: string;
|
||||
|
@ -17,6 +30,7 @@ export type ApiErrorResponseData = {
|
|||
details: Record< string, ApiErrorResponseDataDetails >;
|
||||
// Some endpoints return cart data to update the client.
|
||||
cart?: CartResponse | undefined;
|
||||
notices?: WCNoticeList;
|
||||
} | null;
|
||||
|
||||
// The details object lists individual errors for each field.
|
||||
|
|
Loading…
Reference in New Issue