aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/videos/services
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-21 18:03:34 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-21 18:08:23 +0200
commit501bc6c2b186f6a724a5b619d15aa44791f13995 (patch)
tree4a6e1d244c5f94305a25b6ec6f50f1a71ce9295d /client/angular/videos/services
parent295ba044afc394ef51dac22263063670362787ec (diff)
downloadPeerTube-501bc6c2b186f6a724a5b619d15aa44791f13995.tar.gz
PeerTube-501bc6c2b186f6a724a5b619d15aa44791f13995.tar.zst
PeerTube-501bc6c2b186f6a724a5b619d15aa44791f13995.zip
Thumbnail, author and duration support in client
Diffstat (limited to 'client/angular/videos/services')
-rw-r--r--client/angular/videos/services/videos.service.ts45
1 files changed, 0 insertions, 45 deletions
diff --git a/client/angular/videos/services/videos.service.ts b/client/angular/videos/services/videos.service.ts
deleted file mode 100644
index d08548339..000000000
--- a/client/angular/videos/services/videos.service.ts
+++ /dev/null
@@ -1,45 +0,0 @@
1import { Injectable } from '@angular/core';
2import { Http, Response } from '@angular/http';
3import { Observable } from 'rxjs/Rx';
4
5import { Video } from '../models/video';
6import { AuthService } from '../../users/services/auth.service';
7
8@Injectable()
9export class VideosService {
10 private _baseVideoUrl = '/api/v1/videos/';
11
12 constructor (private http: Http, private _authService: AuthService) {}
13
14 getVideos() {
15 return this.http.get(this._baseVideoUrl)
16 .map(res => <Video[]> res.json())
17 .catch(this.handleError);
18 }
19
20 getVideo(id: string) {
21 return this.http.get(this._baseVideoUrl + id)
22 .map(res => <Video> res.json())
23 .catch(this.handleError);
24 }
25
26 removeVideo(id: string) {
27 if (confirm('Are you sure?')) {
28 const options = this._authService.getAuthRequestOptions();
29 return this.http.delete(this._baseVideoUrl + id, options)
30 .map(res => <number> res.status)
31 .catch(this.handleError);
32 }
33 }
34
35 searchVideos(search: string) {
36 return this.http.get(this._baseVideoUrl + 'search/' + search)
37 .map(res => <Video> res.json())
38 .catch(this.handleError);
39 }
40
41 private handleError (error: Response) {
42 console.error(error);
43 return Observable.throw(error.json().error || 'Server error');
44 }
45}