Files
bigcapital/packages/webapp/src/store/ResetMiddleware.tsx
2023-02-03 01:02:31 +02:00

14 lines
347 B
TypeScript

// @ts-nocheck
export default (next) => (reducer, initialState, enhancer) => {
let resetType = 'RESET'
let resetData = 'state'
const enhanceReducer = (state, action) => {
if (action.type === resetType) {
state = action[resetData]
}
return reducer(state, action)
}
return next(enhanceReducer, initialState, enhancer)
}