Skip to content

Commit dafe5ce

Browse files
author
pigr2
committed
rename as per tutorial
1 parent 1533153 commit dafe5ce

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

app/app.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {Observable} from 'rxjs/Rx';
44
import {ProximitySelector} from './components/proximity-selector.component';
55
import {SearchBox} from './components/search-box.component';
66
import {SearchReducer} from './reducers/search.reducer';
7-
import {SearchQuery} from "./models/search-query.model";
7+
import {CurrentSearch} from "./models/current-search.model";
88
import {YouTubeService} from "./services/youtube.service";
99
import {SearchResult} from "./models/search-result.model";
1010

@@ -44,21 +44,21 @@ export class AppComponent implements OnInit {
4444

4545
title = ''; //'One Source of Truth for Angular 2';
4646

47-
private state: SearchQuery;
47+
private state: CurrentSearch;
4848

49-
private currentSearch: Observable<SearchQuery>;
49+
private currentSearch: Observable<CurrentSearch>;
5050
private searchResults: SearchResult[] = [];
5151

5252
constructor(
53-
private store: Store<SearchQuery>,
53+
private store: Store<CurrentSearch>,
5454
private youtube: YouTubeService
5555
) {
56-
this.currentSearch = this.store.select<SearchQuery>('currentSearch');
56+
this.currentSearch = this.store.select<CurrentSearch>('currentSearch');
5757
this.youtube.searchResults.subscribe((results: SearchResult[]) => this.searchResults = results);
5858
}
5959

6060
ngOnInit() {
61-
this.currentSearch.subscribe((state: SearchQuery) => {
61+
this.currentSearch.subscribe((state: CurrentSearch) => {
6262
this.state = state;
6363
if (state && state.name && state.name.length > 0) {
6464
this.youtube.search(state)

app/models/search-query.model.ts renamed to app/models/current-search.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface SearchQuery {
1+
export interface CurrentSearch {
22
name: string;
33
location?: {
44
latitude: number,

app/reducers/search.reducer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { ActionReducer, Action } from '@ngrx/store';
22
import {SearchBox} from '../components/search-box.component';
33
import {ProximitySelector} from '../components/proximity-selector.component';
4-
import {SearchQuery} from "../models/search-query.model";
4+
import {CurrentSearch} from "../models/current-search.model";
55

6-
export const SearchReducer: ActionReducer<SearchQuery> = (state: SearchQuery, action: Action) => {
6+
export const SearchReducer: ActionReducer<CurrentSearch> = (state: CurrentSearch, action: Action) => {
77
switch (action.type) {
88
case SearchBox.StoreEvents.text:
99
return Object.assign({}, state, {

app/services/youtube.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Observable, BehaviorSubject} from 'rxjs/Rx';
22
import {Injectable} from '@angular/core';
33
import {Response, Http} from '@angular/http';
44
import {SearchResult} from '../models/search-result.model';
5-
import {SearchQuery} from '../models/search-query.model';
5+
import {CurrentSearch} from '../models/current-search.model';
66

77
const YOUTUBE_API_KEY = 'AIzaSyDOfT_BO81aEZScosfTYMruJobmpjqNeEk';
88
const YOUTUBE_API_URL = 'https://www.googleapis.com/youtube/v3/search';
@@ -16,7 +16,7 @@ export class YouTubeService {
1616

1717
constructor( private http: Http ) {}
1818

19-
search(query: SearchQuery): Observable<SearchResult[]> {
19+
search(query: CurrentSearch): Observable<SearchResult[]> {
2020
let params = [
2121
`q=${query.name}`,
2222
`key=${YOUTUBE_API_KEY}`,

0 commit comments

Comments
 (0)