mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-22 08:46:54 -06:00
Add authentication tokens to make friends/quit friends
This commit is contained in:
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 { 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',
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
@ -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'
|
||||
|
3
client/app/shared/search/index.ts
Normal file
3
client/app/shared/search/index.ts
Normal file
@ -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({
|
||||
selector: 'my-search',
|
||||
templateUrl: 'client/app/shared/search.component.html',
|
||||
templateUrl: 'client/app/shared/search/search.component.html',
|
||||
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 { 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()
|
||||
|
@ -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',
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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',
|
||||
|
@ -23,18 +23,18 @@
|
||||
"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",
|
||||
|
Loading…
Reference in New Issue
Block a user