redux-axios-middleware
redux-axios-middleware copied to clipboard
How to handle _FAIL actions
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 what did you do to solve this?