mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-07 19:28:11 +08:00
reducer & store setup
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
const Cells = (state = {
|
||||||
|
cells: null,
|
||||||
|
loading: null,
|
||||||
|
error: null,
|
||||||
|
}, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case "REQUEST_CELLS":
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
loading: true,
|
||||||
|
error: null
|
||||||
|
});
|
||||||
|
case "RECEIVE_CELLS":
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
error: null,
|
||||||
|
cells: action.data,
|
||||||
|
});
|
||||||
|
case "CELLS_FETCH_ERROR":
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
cells: null,
|
||||||
|
error: action.data
|
||||||
|
});
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Cells;
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { combineReducers, createStore } from 'redux'
|
||||||
|
import cells from './cells'
|
||||||
|
|
||||||
|
const Reducer = combineReducers({
|
||||||
|
cells,
|
||||||
|
})
|
||||||
|
|
||||||
|
let store = createStore(Reducer);
|
||||||
|
|
||||||
|
export default store;
|
||||||
Reference in New Issue
Block a user