rename url reducer

This commit is contained in:
Colin Megill
2017-10-12 19:32:27 -07:00
parent 381e6fe927
commit d6b91176c4
3 changed files with 36 additions and 29 deletions
+5 -4
View File
@@ -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;
-25
View File
@@ -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;
+31
View File
@@ -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;