]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add authentication tokens to make friends/quit friends
authorChocobozzz <florian.bigard@gmail.com>
Wed, 1 Jun 2016 18:36:27 +0000 (20:36 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Wed, 1 Jun 2016 18:36:27 +0000 (20:36 +0200)
23 files changed:
client/app/app.component.ts
client/app/friends/friend.service.ts
client/app/login/index.ts [moved from client/app/users/login/index.ts with 100% similarity]
client/app/login/login.component.html [moved from client/app/users/login/login.component.html with 100% similarity]
client/app/login/login.component.ts [moved from client/app/users/login/login.component.ts with 80% similarity]
client/app/shared/index.ts
client/app/shared/search/index.ts [new file with mode: 0644]
client/app/shared/search/search-field.type.ts [moved from client/app/shared/search-field.type.ts with 100% similarity]
client/app/shared/search/search.component.html [moved from client/app/shared/search.component.html with 100% similarity]
client/app/shared/search/search.component.ts [moved from client/app/shared/search.component.ts with 93% similarity]
client/app/shared/search/search.model.ts [moved from client/app/shared/search.model.ts with 100% similarity]
client/app/shared/users/auth-status.model.ts [moved from client/app/users/shared/auth-status.model.ts with 100% similarity]
client/app/shared/users/auth.service.ts [moved from client/app/users/shared/auth.service.ts with 100% similarity]
client/app/shared/users/index.ts [moved from client/app/users/shared/index.ts with 100% similarity]
client/app/shared/users/token.model.ts [moved from client/app/users/shared/token.model.ts with 100% similarity]
client/app/shared/users/user.model.ts [moved from client/app/users/shared/user.model.ts with 100% similarity]
client/app/users/index.ts [deleted file]
client/app/users/login/login.component.scss [deleted file]
client/app/videos/shared/video.service.ts
client/app/videos/video-add/video-add.component.ts
client/app/videos/video-list/video-list.component.ts
client/app/videos/video-list/video-miniature.component.ts
client/tsconfig.json

index d29448296cdd2536d4f4c197c667135e6edcd763..94924a47aba2dedb0ad7be1bd02e085baa126cf8 100644 (file)
@@ -3,12 +3,13 @@ import { HTTP_PROVIDERS } from '@angular/http';
 import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
 
 import { FriendService } from './friends/index';
-import { Search, SearchComponent } from './shared/index';
+import { LoginComponent } from './login/index';
 import {
-  UserLoginComponent,
   AuthService,
-  AuthStatus
-} from './users/index';
+  AuthStatus,
+  Search,
+  SearchComponent
+} from './shared/index';
 import {
   VideoAddComponent,
   VideoListComponent,
@@ -20,7 +21,7 @@ import {
   {
     path: '/users/login',
     name: 'UserLogin',
-    component: UserLoginComponent
+    component: LoginComponent
   },
   {
     path: '/videos/list',
index bdfa7baeca1622057838874035e0655354adcaed..d3684f08db021785e4780b7fd2eca268496fd5d9 100644 (file)
@@ -2,20 +2,24 @@ import { Injectable } from '@angular/core';
 import { Http, Response } from '@angular/http';
 import { Observable } from 'rxjs/Rx';
 
+import { AuthService } from '../shared/index';
+
 @Injectable()
 export class FriendService {
   private static BASE_FRIEND_URL: string = '/api/v1/pods/';
 
-  constructor (private http: Http) {}
+  constructor (private http: Http, private authService: AuthService) {}
 
   makeFriends() {
-    return this.http.get(FriendService.BASE_FRIEND_URL + 'makefriends')
+    const headers = this.authService.getRequestHeader();
+    return this.http.get(FriendService.BASE_FRIEND_URL + 'makefriends', { headers })
                     .map(res => res.status)
                     .catch(this.handleError);
   }
 
   quitFriends() {
-    return this.http.get(FriendService.BASE_FRIEND_URL + 'quitfriends')
+    const headers = this.authService.getRequestHeader();
+    return this.http.get(FriendService.BASE_FRIEND_URL + 'quitfriends', { headers })
                     .map(res => res.status)
                     .catch(this.handleError);
   }
similarity index 80%
rename from client/app/users/login/login.component.ts
rename to client/app/login/login.component.ts
index 09c5f1af7070cc91391b4624a348b02228cb4a1d..50f598d926d7ec3d7455c58487a5a67447c5fdcb 100644 (file)
@@ -4,12 +4,11 @@ import { Router } from '@angular/router-deprecated';
 import { AuthService, AuthStatus, User } from '../shared/index';
 
 @Component({
-  selector: 'my-user-login',
-  styleUrls: [ 'client/app/users/login/login.component.css' ],
-  templateUrl: 'client/app/users/login/login.component.html'
+  selector: 'my-login',
+  templateUrl: 'client/app/login/login.component.html'
 })
 
-export class UserLoginComponent {
+export class LoginComponent {
   constructor(
     private authService: AuthService,
     private router: Router
index a49a4f1a95e9ee9caa82a07d3ac19d830e709bae..ad3ee0098124d660c0c8f88863ea06f84bd76fcb 100644 (file)
@@ -1,3 +1,2 @@
-export * from './search-field.type';
-export * from './search.component';
-export * from './search.model';
+export * from './search/index';
+export * from './users/index'
diff --git a/client/app/shared/search/index.ts b/client/app/shared/search/index.ts
new file mode 100644 (file)
index 0000000..a49a4f1
--- /dev/null
@@ -0,0 +1,3 @@
+export * from './search-field.type';
+export * from './search.component';
+export * from './search.model';
similarity index 93%
rename from client/app/shared/search.component.ts
rename to client/app/shared/search/search.component.ts
index e1e30b9af04bca26da7e7c473ccc183ff540e641..d541cd0d60982cef6ce22d7c079b8d9eebd2cf97 100644 (file)
@@ -7,7 +7,7 @@ import { SearchField } from './search-field.type';
 
 @Component({
     selector: 'my-search',
-    templateUrl: 'client/app/shared/search.component.html',
+    templateUrl: 'client/app/shared/search/search.component.html',
     directives: [ DROPDOWN_DIRECTIVES ]
 })
 
diff --git a/client/app/users/index.ts b/client/app/users/index.ts
deleted file mode 100644 (file)
index 4f08b8b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './login/index';
-export * from './shared/index';
diff --git a/client/app/users/login/login.component.scss b/client/app/users/login/login.component.scss
deleted file mode 100644 (file)
index e69de29..0000000
index 7b6519f007a01f807f7c4f9a83ff6b377a1b9106..a786b2ab26984ab601a10cc56f4e291b7b1226ee 100644 (file)
@@ -5,7 +5,7 @@ import { Observable } from 'rxjs/Rx';
 import { Pagination } from './pagination.model';
 import { Search } from '../../shared/index';
 import { SortField } from './sort-field.type';
-import { AuthService } from '../../users/index';
+import { AuthService } from '../../shared/index';
 import { Video } from './video.model';
 
 @Injectable()
index 619a4f4d868ee330b9622a6e0103531768633d89..e17b1b0f6b389027acf9ed9dd9911fc11eed417e 100644 (file)
@@ -7,7 +7,7 @@ import { Router } from '@angular/router-deprecated';
 import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
 import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar';
 
-import { AuthService, User } from '../../users/index';
+import { AuthService, User } from '../../shared/index';
 
 @Component({
   selector: 'my-videos-add',
index 6322860be8b0e8f3cd8d9a8f4df1a649af4fd9f3..baca00deb10877ffdccb1dadc11a857061f67e44 100644 (file)
@@ -10,8 +10,7 @@ import {
   Video,
   VideoService
 } from '../shared/index';
-import { Search, SearchField } from '../../shared/index';
-import { AuthService, User } from '../../users/index';
+import { AuthService, Search, SearchField, User } from '../../shared/index';
 import { VideoMiniatureComponent } from './video-miniature.component';
 import { VideoSortComponent } from './video-sort.component';
 
index 3baa1ddd648a6210063907819232c25857533af7..11b828ca6a17a0c624976412e137ed2ea7327380 100644 (file)
@@ -3,7 +3,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
 import { ROUTER_DIRECTIVES } from '@angular/router-deprecated';
 
 import { Video, VideoService } from '../shared/index';
-import { User } from '../../users/index';
+import { User } from '../../shared/index';
 
 @Component({
   selector: 'my-video-miniature',
index 24583f6c3e57168a8c54da3178a5c8f5c553aa02..a8b8269a49ee66ea71d8008a59d2df512ce2d2a1 100644 (file)
     "app/app.component.ts",
     "app/friends/friend.service.ts",
     "app/friends/index.ts",
+    "app/login/index.ts",
+    "app/login/login.component.ts",
     "app/shared/index.ts",
-    "app/shared/search-field.type.ts",
-    "app/shared/search.component.ts",
-    "app/shared/search.model.ts",
-    "app/users/index.ts",
-    "app/users/login/index.ts",
-    "app/users/login/login.component.ts",
-    "app/users/shared/auth-status.model.ts",
-    "app/users/shared/auth.service.ts",
-    "app/users/shared/index.ts",
-    "app/users/shared/token.model.ts",
-    "app/users/shared/user.model.ts",
+    "app/shared/search/index.ts",
+    "app/shared/search/search-field.type.ts",
+    "app/shared/search/search.component.ts",
+    "app/shared/search/search.model.ts",
+    "app/shared/users/auth-status.model.ts",
+    "app/shared/users/auth.service.ts",
+    "app/shared/users/index.ts",
+    "app/shared/users/token.model.ts",
+    "app/shared/users/user.model.ts",
     "app/videos/index.ts",
     "app/videos/shared/index.ts",
     "app/videos/shared/loader/index.ts",