Commiting
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable'
|
||||
import {
|
||||
STATUS_REVISIONS_LOAD,
|
||||
STATUS_REVISIONS_LOAD_REQUEST,
|
||||
STATUS_REVISIONS_LOAD_SUCCESS,
|
||||
STATUS_REVISIONS_LOAD_FAIL
|
||||
} from '../actions/status_revisions'
|
||||
@@ -13,15 +13,17 @@ const initialState = ImmutableMap({
|
||||
|
||||
export default function statusRevisions(state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case STATUS_REVISIONS_LOAD:
|
||||
return initialState
|
||||
case STATUS_REVISIONS_LOAD_REQUEST:
|
||||
return state.withMutations((mutable) => {
|
||||
mutable.set('loading', true)
|
||||
})
|
||||
case STATUS_REVISIONS_LOAD_SUCCESS:
|
||||
return state.withMutations(mutable => {
|
||||
return state.withMutations((mutable) => {
|
||||
mutable.set('loading', false)
|
||||
mutable.set('revisions', fromJS(action.revisions).reverse())
|
||||
})
|
||||
case STATUS_REVISIONS_LOAD_FAIL:
|
||||
return state.withMutations(mutable => {
|
||||
return state.withMutations((mutable) => {
|
||||
mutable.set('loading', false)
|
||||
mutable.set('error', action.error)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user