actions.js
2 years ago
constants.js
2 years ago
default.state.js
2 years ago
dispatchers.js
2 years ago
functions.js
2 years ago
index.js
2 years ago
loading.state.js
2 years ago
reducer.js
2 years ago
selectors.js
2 years ago
actions.js
73 lines
| 1 | import constants from './constants'; |
| 2 | |
| 3 | export default { |
| 4 | setCurrentAction( item = {} ) { |
| 5 | return { |
| 6 | type: constants.setCurrentAction, |
| 7 | item, |
| 8 | }; |
| 9 | }, |
| 10 | setMeta( item ) { |
| 11 | return { |
| 12 | type: constants.setMeta, |
| 13 | item, |
| 14 | }; |
| 15 | }, |
| 16 | clearCurrent() { |
| 17 | return { type: constants.clearCurrent }; |
| 18 | }, |
| 19 | setLoading( item ) { |
| 20 | return { |
| 21 | type: constants.setLoading, |
| 22 | state: { |
| 23 | id: item.actionId, |
| 24 | state: 'loading', |
| 25 | loading: true, |
| 26 | }, |
| 27 | }; |
| 28 | }, |
| 29 | setLoadingResult( item ) { |
| 30 | return { |
| 31 | type: constants.setLoadingResult, |
| 32 | state: { |
| 33 | id: item.actionId, |
| 34 | state: item.success ? 'is-valid' : 'is-invalid', |
| 35 | success: item.success, |
| 36 | response: item.response, |
| 37 | loading: false, |
| 38 | }, |
| 39 | }; |
| 40 | }, |
| 41 | updateCurrentSettings( item ) { |
| 42 | return { |
| 43 | type: constants.updateCurrentSettings, |
| 44 | item, |
| 45 | }; |
| 46 | }, |
| 47 | updateCurrentConditions( item ) { |
| 48 | return { |
| 49 | type: constants.updateCurrentConditions, |
| 50 | item, |
| 51 | }; |
| 52 | }, |
| 53 | addCallback( actionType, callback ) { |
| 54 | return { |
| 55 | type: constants.addCallback, |
| 56 | actionType, |
| 57 | callback, |
| 58 | }; |
| 59 | }, |
| 60 | addDetail( actionType, item ) { |
| 61 | return { |
| 62 | type: constants.addDetail, |
| 63 | actionType, |
| 64 | item, |
| 65 | }; |
| 66 | }, |
| 67 | addComputedField( field ) { |
| 68 | return { |
| 69 | type: constants.addComputedField, |
| 70 | field, |
| 71 | }; |
| 72 | }, |
| 73 | }; |