File tree Expand file tree Collapse file tree 3 files changed +18
-33
lines changed Expand file tree Collapse file tree 3 files changed +18
-33
lines changed Original file line number Diff line number Diff line change @@ -4,18 +4,12 @@ import {Observable} from "rxjs/Rx";
4
4
import { ProximitySelector } from "./components/proximity-selector.component" ;
5
5
import { SearchBox } from "./components/search-box.component" ;
6
6
import { searchReducer } from "./reducers/search.reducer" ;
7
- import { locationReducer } from "./reducers/location.reducer" ;
8
7
import { CurrentSearch } from "./models/current-search.model" ;
9
8
10
- const mainReducer = combineReducers ( {
11
- searchByName : searchReducer ,
12
- searchByLocation : locationReducer
13
- } ) ;
14
-
15
9
@Component ( {
16
10
selector : 'my-app' ,
17
11
providers : [
18
- provideStore ( { currentSearch : mainReducer } )
12
+ provideStore ( { currentSearch : searchReducer } )
19
13
] ,
20
14
directives : [ SearchBox , ProximitySelector ] ,
21
15
template : `
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
import { ActionReducer , Action } from '@ngrx/store' ;
2
2
import { CurrentSearch } from "../models/current-search.model" ;
3
3
import { SearchBox } from "../components/search-box.component" ;
4
+ import { ProximitySelector } from "../components/proximity-selector.component" ;
4
5
5
6
export const searchReducer : ActionReducer < CurrentSearch > = ( state : CurrentSearch , action : Action ) => {
6
7
switch ( action . type ) {
7
8
case SearchBox . StoreEvents . text :
8
9
return Object . assign ( { } , state , {
9
10
text : action . payload . text
10
11
} ) ;
12
+ case ProximitySelector . StoreEvents . position :
13
+ return Object . assign ( { } , state , {
14
+ position : {
15
+ latitude : action . payload . position . latitude ,
16
+ longitude : action . payload . position . longitude
17
+ }
18
+ } ) ;
19
+ case ProximitySelector . StoreEvents . off :
20
+ return Object . assign ( { } , state , {
21
+ position : null ,
22
+ radius : null
23
+ } ) ;
24
+ case ProximitySelector . StoreEvents . radius :
25
+ return Object . assign ( { } , state , {
26
+ radius : action . payload . radius
27
+ } ) ;
11
28
default :
12
29
return state ;
13
30
}
You can’t perform that action at this time.
0 commit comments