mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-24 19:48:12 +08:00
rename url reducer
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
import { combineReducers, createStore, applyMiddleware } from 'redux';
|
||||
import updateURLMiddleware from "../middleware/updateURLMiddleware";
|
||||
import cells from './cells';
|
||||
import onURLchange from "./onURLchange";
|
||||
import thunk from "redux-thunk";
|
||||
import cells from "./cells";
|
||||
import url from "./url";
|
||||
|
||||
const Reducer = combineReducers({
|
||||
cells,
|
||||
onURLchange,
|
||||
url,
|
||||
})
|
||||
|
||||
let store = createStore(
|
||||
Reducer,
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
|
||||
applyMiddleware(updateURLMiddleware)
|
||||
applyMiddleware(thunk, updateURLMiddleware)
|
||||
);
|
||||
|
||||
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