mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-08 06:58:11 +08:00
rename url reducer
This commit is contained in:
@@ -1,17 +1,18 @@
|
|||||||
import { combineReducers, createStore, applyMiddleware } from 'redux';
|
import { combineReducers, createStore, applyMiddleware } from 'redux';
|
||||||
import updateURLMiddleware from "../middleware/updateURLMiddleware";
|
import updateURLMiddleware from "../middleware/updateURLMiddleware";
|
||||||
import cells from './cells';
|
import thunk from "redux-thunk";
|
||||||
import onURLchange from "./onURLchange";
|
import cells from "./cells";
|
||||||
|
import url from "./url";
|
||||||
|
|
||||||
const Reducer = combineReducers({
|
const Reducer = combineReducers({
|
||||||
cells,
|
cells,
|
||||||
onURLchange,
|
url,
|
||||||
})
|
})
|
||||||
|
|
||||||
let store = createStore(
|
let store = createStore(
|
||||||
Reducer,
|
Reducer,
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
|
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
|
||||||
applyMiddleware(updateURLMiddleware)
|
applyMiddleware(thunk, updateURLMiddleware)
|
||||||
);
|
);
|
||||||
|
|
||||||
export default store;
|
export default store;
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
import URI from "urijs";
|
|
||||||
/*
|
|
||||||
https://www.npmjs.com/package/url-parse
|
|
||||||
*/
|
|
||||||
|
|
||||||
const onURLchange = (
|
|
||||||
state = {},
|
|
||||||
action
|
|
||||||
) => {
|
|
||||||
switch (action.type) {
|
|
||||||
case 'url changed': {
|
|
||||||
const {url} = action;
|
|
||||||
|
|
||||||
const parsed = URI.parseQuery(window.location.search);
|
|
||||||
|
|
||||||
console.log("onURLchange sees: ", parsed)
|
|
||||||
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default onURLchange;
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import uri from "urijs";
|
||||||
|
/*
|
||||||
|
https://www.npmjs.com/package/url-parse
|
||||||
|
*/
|
||||||
|
|
||||||
|
const url = (
|
||||||
|
state = {},
|
||||||
|
action
|
||||||
|
) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case "url changed": {
|
||||||
|
const {url} = action;
|
||||||
|
|
||||||
|
// const parsed = uri.parseQuery(window.location.search);
|
||||||
|
|
||||||
|
// console.log("onURLchange sees: ", state, parsed)
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
case "category changed": {
|
||||||
|
/* TODO catch categories here and store a representation of them */
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default url;
|
||||||
Reference in New Issue
Block a user