aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/main.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-20 16:24:18 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-20 16:25:06 +0200
commitbd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869 (patch)
tree66df283a1554f27b92e392fca36b8e272d7535bc /client/src/main.ts
parent2f372a865487427ff97ad17edd0e6adfbb478c80 (diff)
downloadPeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.tar.gz
PeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.tar.zst
PeerTube-bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869.zip
Client: Add authHttp service that authentificates the http request and
optionally refresh the access token if needed
Diffstat (limited to 'client/src/main.ts')
-rw-r--r--client/src/main.ts20
1 files changed, 18 insertions, 2 deletions
diff --git a/client/src/main.ts b/client/src/main.ts
index f9c1d50b8..a78d275ad 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -1,12 +1,28 @@
1import { enableProdMode } from '@angular/core'; 1import { enableProdMode, provide } from '@angular/core';
2import {
3 HTTP_PROVIDERS,
4 RequestOptions,
5 XHRBackend
6} from '@angular/http';
2import { bootstrap } from '@angular/platform-browser-dynamic'; 7import { bootstrap } from '@angular/platform-browser-dynamic';
3import { provideRouter } from '@angular/router'; 8import { provideRouter } from '@angular/router';
4 9
5import { AppComponent } from './app/app.component'; 10import { AppComponent } from './app/app.component';
6import { routes } from './app/app.routes'; 11import { routes } from './app/app.routes';
12import { AuthHttp, AuthService } from './app/shared';
7 13
8if (process.env.ENV === 'production') { 14if (process.env.ENV === 'production') {
9 enableProdMode(); 15 enableProdMode();
10} 16}
11 17
12bootstrap(AppComponent, [ provideRouter(routes) ]); 18bootstrap(AppComponent, [
19 HTTP_PROVIDERS,
20 provide(AuthHttp, {
21 useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => {
22 return new AuthHttp(backend, defaultOptions, authService);
23 },
24 deps: [ XHRBackend, RequestOptions, AuthService ]
25 }),
26 AuthService,
27 provideRouter(routes)
28]);