зеркало из https://github.com/Azure/Sia-EventUI.git
Added actions and reducer for globalActions
This commit is contained in:
Родитель
a71203f7e9
Коммит
b2d2fa33c1
|
@ -0,0 +1,27 @@
|
|||
import { reduxBackedPromise } from './actionHelpers'
|
||||
|
||||
export const TRY_GET_GLOBAL_ACTIONS = 'TRY_GET_GLOBAL_ACTIONS'
|
||||
export const GET_GLOBAL_ACTIONS_SUCCESS = 'GET_GLOBAL_ACTIONS_SUCCESS'
|
||||
export const GET_GLOBAL_ACTIONS_FAILURE = 'GET_GLOBAL_ACTIONS_FAILURE'
|
||||
|
||||
|
||||
export const fetchGlobalActions = () => reduxBackedPromise(
|
||||
['globalActions/'],
|
||||
getGlobalActionsActionSet
|
||||
)
|
||||
|
||||
export const getGlobalActionsActionSet = ({
|
||||
try: () => ({
|
||||
type: TRY_GET_GLOBAL_ACTIONS
|
||||
}),
|
||||
|
||||
succeed: (globalActions) => ({
|
||||
type: GET_GLOBAL_ACTIONS_SUCCESS,
|
||||
globalActions
|
||||
}),
|
||||
|
||||
fail: (failureReason) => ({
|
||||
type: GET_GLOBAL_ACTIONS_FAILURE,
|
||||
failureReason
|
||||
})
|
||||
})
|
|
@ -0,0 +1,15 @@
|
|||
import * as globalActionActions from '../actions/globalActionActions'
|
||||
import { mergeToStateById } from './reducerHelpers'
|
||||
|
||||
const defaultGlobalActionCollection = {}
|
||||
|
||||
export const records = (state = defaultGlobalActionCollection, action) => {
|
||||
switch(action.type){
|
||||
case globalActionActions.GET_GLOBAL_ACTIONS_SUCCESS:
|
||||
return mergeToStateById(state, action.globalActions)
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
||||
export default records
|
Загрузка…
Ссылка в новой задаче