UNPKG

@commercetools-frontend/actions-global

Version:
28 lines (27 loc) 1.67 kB
import type { ThunkDispatch } from 'redux-thunk'; import type { TAppNotificationApiError, TStatusCode } from '@commercetools-frontend/constants'; import showApiErrorNotification from './show-api-error-notification'; import showUnexpectedErrorNotification from './show-unexpected-error-notification'; type ApiError = { statusCode: TStatusCode; body: { message: string; errors?: TAppNotificationApiError | TAppNotificationApiError[]; }; }; export type ActionError = Error | ApiError; export type DispatchActionError = ThunkDispatch<null, null, ReturnType<typeof showApiErrorNotification> | ReturnType<typeof showUnexpectedErrorNotification>>; export default function handleActionError(error: ActionError): (dispatch: DispatchActionError) => import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & { kind: import("@commercetools-frontend/constants").TAppNotificationKindPage; } & { id: number; text?: undefined; values?: import("@commercetools-frontend/constants").TAppNotificationValuesApiError<{}> | undefined; } & import("@commercetools-frontend/notifications").TNotification> | import("@commercetools-frontend/notifications").TAddNotificationAction<import("@commercetools-frontend/constants").TAppNotificationOfDomain & { kind: import("@commercetools-frontend/constants").TAppNotificationKindPage; } & { id: number; text?: undefined; values?: import("@commercetools-frontend/constants").TAppNotificationValuesUnexpectedError | undefined; } & import("@commercetools-frontend/notifications").TNotification> | null; export {};