Router done

This commit is contained in:
Edin Dazdarevic
2017-04-09 23:39:38 +02:00
parent 1fdcc24827
commit 4df688ac60
7 changed files with 86 additions and 53 deletions

View File

@@ -13,8 +13,12 @@ const getInitialState = (url) => {
for(const param of params) {
const [key, value] = param.split("=");
console.log('analyzing param ', key, value);
if (key === "rooms" && value !== '') {
console.log("IT's ROOMS");
value.split(",").forEach(k => {
console.log("IT's ROOMS", k);
initialState.rooms[parseInt(k)] = true;
});
}
@@ -30,16 +34,20 @@ const getInitialState = (url) => {
}
if (key === "bounds") {
// TODO: save bounds
initialState.bounds = value;
}
if (key === "listingId") {
initialState.listingId = value;
}
if (key === "zoom") {
initialState.zoom = parseInt(value);
}
}
console.log('initial state dump', initialState);
console.log('initial state ROOMS', initialState.rooms);
return initialState;
}