Location edition

This commit is contained in:
vjrj 2018-07-05 12:50:08 +02:00
parent e55edce3d4
commit 87718b7ad5
15 changed files with 138 additions and 75 deletions

View file

@ -41,15 +41,16 @@ void fetchYourLocationsMiddleware(
// FXIME save lat/lon
} else {
// No subscribed (only local)
store.dispatch(new UpdateYourLocationAction(action.loc));
persistYourLocations(store.state.yourLocations);
}
}
if (action is AddYourLocationAction) {
if (action.loc.subscribed) {
subscribeViaApi(store, action.loc,
(sub) => store.dispatch(new AddedYourLocationAction(sub)));
(sub) {
store.dispatch(new AddedYourLocationAction(sub));
persistYourLocations(store.state.yourLocations);
});
} else {
// No subscribed (only local)
store.dispatch(new AddedYourLocationAction(action.loc));
@ -73,7 +74,6 @@ void fetchYourLocationsMiddleware(
.getYourLocationFireStats(store.state, action.loc)
.then((result) => store.dispatch(result));
}
if (action is UpdateYourLocationAction) {
if (action.loc.subscribed)
Debounce.seconds(
@ -84,6 +84,8 @@ void fetchYourLocationsMiddleware(
else {
// FIXME do something?
}
store.dispatch(new UpdatedYourLocationAction(action.loc));
persistYourLocations(store.state.yourLocations);
}
if (action is SubscribeConfirmAction) {