mirror of https://github.com/fspc/workstand.git
Drew Larson
8 years ago
4 changed files with 8 additions and 19 deletions
@ -1,27 +1,17 @@ |
|||||
import { setBike, setBikes, setBikesIsFetching, setBikesFetched } from './actions'; |
import { setBikes, setBikesFetched, setBikesIsFetching } from './actions'; |
||||
import { handleActions } from 'redux-actions'; |
import { handleActions } from 'redux-actions'; |
||||
|
|
||||
export default handleActions({ |
export default handleActions({ |
||||
[setBikes]: (state, action) => ({ |
[setBikes]: (state, action) => ({ |
||||
...state, |
...state, |
||||
bikes: action.payload, |
entities: action.payload.entities.bikes, |
||||
}), |
}), |
||||
[setBikesIsFetching]: (state, action) => ({ |
[setBikesIsFetching]: (state, action) => ({ |
||||
...state, |
...state, |
||||
bikes: { |
isFetching: action.payload, |
||||
...state.bikes, |
|
||||
isFetching: action.payload, |
|
||||
}, |
|
||||
}), |
}), |
||||
[setBikesFetched]: (state, action) => ({ |
[setBikesFetched]: (state, action) => ({ |
||||
...state, |
...state, |
||||
bikes: { |
fetched: action.payload, |
||||
...state.bikes, |
|
||||
fetched: action.payload |
|
||||
} |
|
||||
}), |
}), |
||||
[setBike]: (state, action) => ({ |
}, { entities: {}, isFetching: false, fetched: false }); |
||||
...state, |
|
||||
...action.payload, |
|
||||
}), |
|
||||
}, { bikes: [], bike: undefined }); |
|
||||
|
Loading…
Reference in new issue