More redux work in fires page
This commit is contained in:
parent
5d947f9577
commit
7dddf03e32
13 changed files with 210 additions and 54 deletions
|
|
@ -4,24 +4,25 @@ import 'package:redux/redux.dart';
|
|||
import 'actions.dart';
|
||||
|
||||
final yourLocationsReducer = combineReducers<List<YourLocation>>([
|
||||
new TypedReducer<List<YourLocation>, AddYourLocationAction>(_addYourLocation),
|
||||
new TypedReducer<List<YourLocation>, DeleteYourLocationAction>(
|
||||
_deleteYourLocation),
|
||||
new TypedReducer<List<YourLocation>, AddedYourLocationAction>(_addedYourLocation),
|
||||
new TypedReducer<List<YourLocation>, DeletedYourLocationAction>(
|
||||
_deletedYourLocation),
|
||||
new TypedReducer<List<YourLocation>, UpdateYourLocationAction>(
|
||||
_updateYourLocation),
|
||||
new TypedReducer<List<YourLocation>, ToggledSubscriptionAction>(_toggledSubscriptionAction)
|
||||
|
||||
/* new TypedReducer<List<YourLocation>, ToggleSubscriptionAction>(_toggleSubscriptionAction),
|
||||
new TypedReducer<List<YourLocation>, SubscribeAction>(_setLoadedYourLocations),
|
||||
new TypedReducer<List<YourLocation>, UnSubscribeAction>(_setNoYourLocations), */
|
||||
]);
|
||||
|
||||
List<YourLocation> _addYourLocation(
|
||||
List<YourLocation> yourLocations, AddYourLocationAction action) {
|
||||
List<YourLocation> _addedYourLocation(
|
||||
List<YourLocation> yourLocations, AddedYourLocationAction action) {
|
||||
return new List.from(yourLocations)..add(action.loc);
|
||||
}
|
||||
|
||||
List<YourLocation> _deleteYourLocation(
|
||||
List<YourLocation> yourLocations, DeleteYourLocationAction action) {
|
||||
List<YourLocation> _deletedYourLocation(
|
||||
List<YourLocation> yourLocations, DeletedYourLocationAction action) {
|
||||
return yourLocations
|
||||
.where((yourLocation) => yourLocation.id != action.id)
|
||||
.toList();
|
||||
|
|
@ -34,13 +35,13 @@ List<YourLocation> _updateYourLocation(
|
|||
yourLocation.id == action.id ? action.loc : yourLocation)
|
||||
.toList();
|
||||
}
|
||||
/*
|
||||
List<YourLocation> _toggleSubscriptionAction(List<YourLocation> yourLocations, UpdateYourLocationAction action) {
|
||||
|
||||
List<YourLocation> _toggledSubscriptionAction(List<YourLocation> yourLocations, ToggledSubscriptionAction action) {
|
||||
return yourLocations
|
||||
.map((yourLocation) => yourLocation.id == action.id ? action.loc : yourLocation)
|
||||
.map((yourLocation) => yourLocation.id == action.loc.id ? action.loc : yourLocation)
|
||||
.toList();
|
||||
}
|
||||
|
||||
/*
|
||||
List<YourLocation> _setLoadedYourLocations(List<YourLocation> yourLocations, YourLocationsLoadedAction action) {
|
||||
return action.yourLocations;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue