mirror of https://github.com/Chocobozzz/PeerTube
Add authentication tokens to make friends/quit friends
parent
575fdcece5
commit
a840d39609
|
@ -3,12 +3,13 @@ import { HTTP_PROVIDERS } from '@angular/http';
|
||||||
import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
|
import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
|
||||||
|
|
||||||
import { FriendService } from './friends/index';
|
import { FriendService } from './friends/index';
|
||||||
import { Search, SearchComponent } from './shared/index';
|
import { LoginComponent } from './login/index';
|
||||||
import {
|
import {
|
||||||
UserLoginComponent,
|
|
||||||
AuthService,
|
AuthService,
|
||||||
AuthStatus
|
AuthStatus,
|
||||||
} from './users/index';
|
Search,
|
||||||
|
SearchComponent
|
||||||
|
} from './shared/index';
|
||||||
import {
|
import {
|
||||||
VideoAddComponent,
|
VideoAddComponent,
|
||||||
VideoListComponent,
|
VideoListComponent,
|
||||||
|
@ -20,7 +21,7 @@ import {
|
||||||
{
|
{
|
||||||
path: '/users/login',
|
path: '/users/login',
|
||||||
name: 'UserLogin',
|
name: 'UserLogin',
|
||||||
component: UserLoginComponent
|
component: LoginComponent
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/videos/list',
|
path: '/videos/list',
|
||||||
|
|
|
@ -2,20 +2,24 @@ import { Injectable } from '@angular/core';
|
||||||
import { Http, Response } from '@angular/http';
|
import { Http, Response } from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
|
||||||
|
import { AuthService } from '../shared/index';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FriendService {
|
export class FriendService {
|
||||||
private static BASE_FRIEND_URL: string = '/api/v1/pods/';
|
private static BASE_FRIEND_URL: string = '/api/v1/pods/';
|
||||||
|
|
||||||
constructor (private http: Http) {}
|
constructor (private http: Http, private authService: AuthService) {}
|
||||||
|
|
||||||
makeFriends() {
|
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)
|
.map(res => res.status)
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
quitFriends() {
|
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)
|
.map(res => res.status)
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,11 @@ import { Router } from '@angular/router-deprecated';
|
||||||
import { AuthService, AuthStatus, User } from '../shared/index';
|
import { AuthService, AuthStatus, User } from '../shared/index';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-user-login',
|
selector: 'my-login',
|
||||||
styleUrls: [ 'client/app/users/login/login.component.css' ],
|
templateUrl: 'client/app/login/login.component.html'
|
||||||
templateUrl: 'client/app/users/login/login.component.html'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export class UserLoginComponent {
|
export class LoginComponent {
|
||||||
constructor(
|
constructor(
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private router: Router
|
private router: Router
|
|
@ -1,3 +1,2 @@
|
||||||
export * from './search-field.type';
|
export * from './search/index';
|
||||||
export * from './search.component';
|
export * from './users/index'
|
||||||
export * from './search.model';
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
export * from './search-field.type';
|
||||||
|
export * from './search.component';
|
||||||
|
export * from './search.model';
|
|
@ -7,7 +7,7 @@ import { SearchField } from './search-field.type';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-search',
|
selector: 'my-search',
|
||||||
templateUrl: 'client/app/shared/search.component.html',
|
templateUrl: 'client/app/shared/search/search.component.html',
|
||||||
directives: [ DROPDOWN_DIRECTIVES ]
|
directives: [ DROPDOWN_DIRECTIVES ]
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
export * from './login/index';
|
|
||||||
export * from './shared/index';
|
|
|
@ -5,7 +5,7 @@ import { Observable } from 'rxjs/Rx';
|
||||||
import { Pagination } from './pagination.model';
|
import { Pagination } from './pagination.model';
|
||||||
import { Search } from '../../shared/index';
|
import { Search } from '../../shared/index';
|
||||||
import { SortField } from './sort-field.type';
|
import { SortField } from './sort-field.type';
|
||||||
import { AuthService } from '../../users/index';
|
import { AuthService } from '../../shared/index';
|
||||||
import { Video } from './video.model';
|
import { Video } from './video.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { Router } from '@angular/router-deprecated';
|
||||||
import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
|
import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
|
||||||
import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar';
|
import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar';
|
||||||
|
|
||||||
import { AuthService, User } from '../../users/index';
|
import { AuthService, User } from '../../shared/index';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-videos-add',
|
selector: 'my-videos-add',
|
||||||
|
|
|
@ -10,8 +10,7 @@ import {
|
||||||
Video,
|
Video,
|
||||||
VideoService
|
VideoService
|
||||||
} from '../shared/index';
|
} from '../shared/index';
|
||||||
import { Search, SearchField } from '../../shared/index';
|
import { AuthService, Search, SearchField, User } from '../../shared/index';
|
||||||
import { AuthService, User } from '../../users/index';
|
|
||||||
import { VideoMiniatureComponent } from './video-miniature.component';
|
import { VideoMiniatureComponent } from './video-miniature.component';
|
||||||
import { VideoSortComponent } from './video-sort.component';
|
import { VideoSortComponent } from './video-sort.component';
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { ROUTER_DIRECTIVES } from '@angular/router-deprecated';
|
import { ROUTER_DIRECTIVES } from '@angular/router-deprecated';
|
||||||
|
|
||||||
import { Video, VideoService } from '../shared/index';
|
import { Video, VideoService } from '../shared/index';
|
||||||
import { User } from '../../users/index';
|
import { User } from '../../shared/index';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-video-miniature',
|
selector: 'my-video-miniature',
|
||||||
|
|
|
@ -23,18 +23,18 @@
|
||||||
"app/app.component.ts",
|
"app/app.component.ts",
|
||||||
"app/friends/friend.service.ts",
|
"app/friends/friend.service.ts",
|
||||||
"app/friends/index.ts",
|
"app/friends/index.ts",
|
||||||
|
"app/login/index.ts",
|
||||||
|
"app/login/login.component.ts",
|
||||||
"app/shared/index.ts",
|
"app/shared/index.ts",
|
||||||
"app/shared/search-field.type.ts",
|
"app/shared/search/index.ts",
|
||||||
"app/shared/search.component.ts",
|
"app/shared/search/search-field.type.ts",
|
||||||
"app/shared/search.model.ts",
|
"app/shared/search/search.component.ts",
|
||||||
"app/users/index.ts",
|
"app/shared/search/search.model.ts",
|
||||||
"app/users/login/index.ts",
|
"app/shared/users/auth-status.model.ts",
|
||||||
"app/users/login/login.component.ts",
|
"app/shared/users/auth.service.ts",
|
||||||
"app/users/shared/auth-status.model.ts",
|
"app/shared/users/index.ts",
|
||||||
"app/users/shared/auth.service.ts",
|
"app/shared/users/token.model.ts",
|
||||||
"app/users/shared/index.ts",
|
"app/shared/users/user.model.ts",
|
||||||
"app/users/shared/token.model.ts",
|
|
||||||
"app/users/shared/user.model.ts",
|
|
||||||
"app/videos/index.ts",
|
"app/videos/index.ts",
|
||||||
"app/videos/shared/index.ts",
|
"app/videos/shared/index.ts",
|
||||||
"app/videos/shared/loader/index.ts",
|
"app/videos/shared/loader/index.ts",
|
||||||
|
|
Loading…
Reference in New Issue