redux-axios-middleware icon indicating copy to clipboard operation
redux-axios-middleware copied to clipboard

How to handle _FAIL actions

Open tjhazel opened this issue 8 years ago • 1 comments

I am following the same pattern used in the middleware-netcore-example. I see _FAIL constants in the app.ts actions file. I am attempting to send failures into state, but I am getting my wires crossed.

state: export type App = { readonly values: { name: string, value: number }[] _readonly errors: [{ message: string, code: number }]_ };

action: export type Action = { type: 'GET_VALUES_FAIL', payload: AxiosResponse } | ... };

reducer: case Actions.GET_VALUES_FAIL: return { ...state, _errors_: action.payload.data };

Ideally i would map the fail action to a list of errors in the state..my app i have a error message action that ties into App.errors. Just not sure now to move forward given the errors live in a different object in state. How can i add this error data to my state?

tjhazel avatar Aug 29 '17 22:08 tjhazel

@tjhazel what did you do to solve this?

acrosson avatar Aug 28 '18 18:08 acrosson