Removed monthlyExpensesComplete from initial state, moved into API call

• Removed:
- monthlyExpensesComplete from initial state, moved into API call
- set up expenses to read from redux for Progress panel/injection
This commit is contained in:
mgabdev
2021-01-15 15:00:20 -05:00
parent 63622b5416
commit cca9a2d24e
6 changed files with 115 additions and 13 deletions

View File

@@ -0,0 +1,23 @@
import { Map as ImmutableMap } from 'immutable'
import {
EXPENSES_FETCH_REQUEST,
EXPENSES_FETCH_SUCCESS,
EXPENSES_FETCH_FAIL,
} from '../actions/expenses'
const initialState = ImmutableMap({
fetched: false,
value: 0,
})
export default function expenses(state = initialState, action) {
switch (action.type) {
case EXPENSES_FETCH_REQUEST:
case EXPENSES_FETCH_FAIL:
return state.set('fetched', true).set('value', 0)
case EXPENSES_FETCH_SUCCESS:
return state.set('fetched', true).set('value', action.value)
default:
return state
}
}