-
-
Save rahulraghavankklm/ba31466f94b51d101094239409b6109a to your computer and use it in GitHub Desktop.
Revisions
-
pace-noge created this gist
May 2, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ export const expenseFormPlugin = (state, action) => { if (action.type === '@@redux-form/CHANGE' && action.meta && action.meta.form === 'expenseForm' && action.meta.field) { if (action.meta.field === 'time' || action.meta.field === 'rate') { const time = state.values.time? parseInt(state.values.time, 10) : 0 const rate = state.values.rate ? parseInt(state.values.rate, 10): 0 const total = time * rate return { ...state, values: { ...state.values, total: total } } } } return state }