openvidu-insecure-angular http module updated. Angular to 6.0.2
This commit is contained in:
parent
88e8930895
commit
ae25814b7a
3072
openvidu-insecure-angular/package-lock.json
generated
3072
openvidu-insecure-angular/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,19 +6,18 @@
|
||||
"start": "ng serve"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/common": "6.0.1",
|
||||
"@angular/compiler": "6.0.1",
|
||||
"@angular/core": "6.0.1",
|
||||
"@angular/http": "6.0.1",
|
||||
"@angular/forms": "6.0.1",
|
||||
"@angular/platform-browser": "6.0.1",
|
||||
"@angular/platform-browser-dynamic": "6.0.1",
|
||||
"@angular/common": "6.0.2",
|
||||
"@angular/compiler": "6.0.2",
|
||||
"@angular/core": "6.0.2",
|
||||
"@angular/http": "6.0.2",
|
||||
"@angular/forms": "6.0.2",
|
||||
"@angular/platform-browser": "6.0.2",
|
||||
"@angular/platform-browser-dynamic": "6.0.2",
|
||||
"core-js": "2.5.6",
|
||||
"openvidu-browser": "2.0.0",
|
||||
"zone.js": "0.8.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "10.0.8",
|
||||
"@angular/cli": "6.0.1",
|
||||
"@angular/compiler-cli": "6.0.1",
|
||||
"@angular-devkit/build-angular": "~0.6.1",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Component, HostListener, Input, OnDestroy } from '@angular/core';
|
||||
import { Http, Headers, RequestOptions } from '@angular/http';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { throwError as observableThrowError, Observable } from 'rxjs';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
|
||||
@ -28,7 +28,7 @@ export class AppComponent implements OnDestroy {
|
||||
// updated by an Output event of StreamComponent children
|
||||
@Input() mainVideoStream: Stream;
|
||||
|
||||
constructor(private http: Http) {
|
||||
constructor(private httpClient: HttpClient) {
|
||||
this.generateParticipantInfo();
|
||||
}
|
||||
|
||||
@ -173,12 +173,13 @@ export class AppComponent implements OnDestroy {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const body = JSON.stringify({ customSessionId: sessionId });
|
||||
const headers = new Headers({
|
||||
'Authorization': 'Basic ' + btoa('OPENVIDUAPP:MY_SECRET'),
|
||||
'Content-Type': 'application/json',
|
||||
});
|
||||
const options = new RequestOptions({ headers });
|
||||
return this.http.post('https://' + location.hostname + ':4443/api/sessions', body, options)
|
||||
const options = {
|
||||
headers: new HttpHeaders({
|
||||
'Authorization': 'Basic ' + btoa('OPENVIDUAPP:MY_SECRET'),
|
||||
'Content-Type': 'application/json'
|
||||
})
|
||||
};
|
||||
return this.httpClient.post('https://' + location.hostname + ':4443/api/sessions', body, options)
|
||||
.pipe(
|
||||
catchError(error => {
|
||||
error.status === 409 ? resolve(sessionId) : reject(error);
|
||||
@ -187,7 +188,7 @@ export class AppComponent implements OnDestroy {
|
||||
)
|
||||
.subscribe(response => {
|
||||
console.log(response);
|
||||
resolve(response.json().id);
|
||||
resolve(response['id']);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -196,12 +197,13 @@ export class AppComponent implements OnDestroy {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const body = JSON.stringify({ session: sessionId });
|
||||
const headers = new Headers({
|
||||
'Authorization': 'Basic ' + btoa('OPENVIDUAPP:MY_SECRET'),
|
||||
'Content-Type': 'application/json',
|
||||
});
|
||||
const options = new RequestOptions({ headers });
|
||||
return this.http.post('https://' + location.hostname + ':4443/api/tokens', body, options)
|
||||
const options = {
|
||||
headers: new HttpHeaders({
|
||||
'Authorization': 'Basic ' + btoa('OPENVIDUAPP:MY_SECRET'),
|
||||
'Content-Type': 'application/json'
|
||||
})
|
||||
};
|
||||
return this.httpClient.post('https://' + location.hostname + ':4443/api/tokens', body, options)
|
||||
.pipe(
|
||||
catchError(error => {
|
||||
reject(error);
|
||||
@ -210,7 +212,7 @@ export class AppComponent implements OnDestroy {
|
||||
)
|
||||
.subscribe(response => {
|
||||
console.log(response);
|
||||
resolve(response.json().token);
|
||||
resolve(response['token']);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { StreamComponent } from './stream.component';
|
||||
@ -13,7 +13,7 @@ import { StreamComponent } from './stream.component';
|
||||
imports: [
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
HttpModule
|
||||
HttpClientModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user