import { Injectable } from '@angular/core'; import { Http, Response, RequestOptions, URLSearchParams } from '@angular/http'; import { Observable } from 'rxjs/Rx'; import { Pagination } from './pagination'; import { Video } from './video'; import { AuthService } from '../users/services/auth.service'; @Injectable() export class VideosService { private _baseVideoUrl = '/api/v1/videos/'; constructor (private http: Http, private _authService: AuthService) {} getVideos(pagination: Pagination) { const params = { search: this.createPaginationParams(pagination) }; return this.http.get(this._baseVideoUrl, params) .map(res => res.json()) .map(this.extractVideos) .catch(this.handleError); } getVideo(id: string) { return this.http.get(this._baseVideoUrl + id) .map(res =>