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:
23
app/javascript/gabsocial/reducers/expenses.js
Normal file
23
app/javascript/gabsocial/reducers/expenses.js
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import compose from './compose'
|
||||
import contexts from './contexts'
|
||||
import custom_emojis from './custom_emojis'
|
||||
import deck from './deck'
|
||||
import expenses from './expenses'
|
||||
import filters from './filters'
|
||||
import groups from './groups'
|
||||
import group_categories from './group_categories'
|
||||
@@ -70,6 +71,7 @@ const reducers = {
|
||||
contexts,
|
||||
custom_emojis,
|
||||
deck,
|
||||
expenses,
|
||||
filters,
|
||||
groups,
|
||||
group_categories,
|
||||
|
||||
Reference in New Issue
Block a user