From bd5c83a8cb46eb6da2b25df3b1f6a2a5795d1869 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Jul 2016 16:24:18 +0200 Subject: Client: Add authHttp service that authentificates the http request and optionally refresh the access token if needed --- client/src/app/app.component.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'client/src/app/app.component.ts') diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 354d00a7a..f53896bcf 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -1,5 +1,4 @@ import { Component } from '@angular/core'; -import { HTTP_PROVIDERS } from '@angular/http'; import { ActivatedRoute, Router, ROUTER_DIRECTIVES } from '@angular/router'; import { FriendService } from './friends'; @@ -16,7 +15,7 @@ import { VideoService } from './videos'; template: require('./app.component.html'), styles: [ require('./app.component.scss') ], directives: [ ROUTER_DIRECTIVES, SearchComponent ], - providers: [ AuthService, FriendService, HTTP_PROVIDERS, VideoService, SearchService ] + providers: [ FriendService, VideoService, SearchService ] }) export class AppComponent { @@ -35,14 +34,20 @@ export class AppComponent { status => { if (status === AuthStatus.LoggedIn) { this.isLoggedIn = true; + console.log('Logged in.'); + } else if (status === AuthStatus.LoggedOut) { + this.isLoggedIn = false; + console.log('Logged out.'); + } else { + console.error('Unknown auth status: ' + status); } } ); } - // FIXME logout() { - // this._authService.logout(); + this.authService.logout(); + this.authService.setStatus(AuthStatus.LoggedOut); } makeFriends() { -- cgit v1.2.3