From 2b9e99a3db594b7cfec65678f5108e1d5facd909 Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Mon, 11 May 2020 12:06:30 -0400 Subject: [PATCH] Checks whether user is logged in --- src/app/app.component.html | 2 +- src/app/app.component.spec.ts | 7 ++++++- src/app/app.component.ts | 10 ++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index c00c62a..80ac792 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,5 +1,5 @@
- +
diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 6ed4289..8a70483 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -1,8 +1,10 @@ +import {HttpClient} from '@angular/common/http'; +import {HttpClientTestingModule} from '@angular/common/http/testing'; import {Component} from '@angular/core'; import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {RouterTestingModule} from '@angular/router/testing'; -import {MockEnvironment} from 'sartography-workflow-lib'; +import {ApiService, MockEnvironment} from 'sartography-workflow-lib'; import {AppComponent} from './app.component'; @@ -32,10 +34,13 @@ describe('AppComponent', () => { MockFooterComponent ], imports: [ + HttpClientTestingModule, BrowserAnimationsModule, RouterTestingModule, ], providers: [ + HttpClient, + ApiService, {provide: 'APP_ENVIRONMENT', useClass: MockEnvironment}, ], }) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index bccfc9b..a1d377a 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {isSignedIn} from 'sartography-workflow-lib'; +import {ApiService} from 'sartography-workflow-lib'; @Component({ selector: 'app-root', @@ -8,5 +8,11 @@ import {isSignedIn} from 'sartography-workflow-lib'; }) export class AppComponent { title = 'CR Connect Configuration'; - isSignedIn = isSignedIn; + + constructor(private apiService: ApiService) { + } + + get isSignedIn() { + return this.apiService.isSignedIn(); + } }