-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/src/app/pages/auth/components/login/login.component.spec.ts b/src/app/pages/auth/components/login/login.component.spec.ts
index 62ebcaa..d29e769 100644
--- a/src/app/pages/auth/components/login/login.component.spec.ts
+++ b/src/app/pages/auth/components/login/login.component.spec.ts
@@ -5,6 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientModule } from '@angular/common/http';
import { ClarityModule } from '@clr/angular';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
+import { SharedModule } from '@shared/shared.module';
describe('LoginComponent', () => {
let component: LoginComponent;
@@ -17,6 +18,7 @@ describe('LoginComponent', () => {
RouterTestingModule,
HttpClientModule,
ClarityModule,
+ SharedModule,
],
declarations: [
LoginComponent,
diff --git a/src/app/pages/auth/components/login/login.component.ts b/src/app/pages/auth/components/login/login.component.ts
index bb0be73..0138cab 100644
--- a/src/app/pages/auth/components/login/login.component.ts
+++ b/src/app/pages/auth/components/login/login.component.ts
@@ -40,13 +40,12 @@ export class LoginComponent {
flatMap(_ => this.returnUrl$),
flatMap(returnUrl => from(this.router.navigateByUrl(returnUrl))))
.subscribe(token => {
- this.loginBtnState = ClrLoadingState.SUCCESS;
- },
- (error: IError) => {
- console.warn('error:', error);
- this.error = error;
- this.loginBtnState = ClrLoadingState.ERROR;
- });
+ this.loginBtnState = ClrLoadingState.SUCCESS;
+ }, (error: IError) => {
+ console.warn('error:', error);
+ this.error = error;
+ this.loginBtnState = ClrLoadingState.ERROR;
+ });
}
}
diff --git a/src/app/pages/auth/components/register/register.component.html b/src/app/pages/auth/components/register/register.component.html
index aa03d2b..7131ce0 100644
--- a/src/app/pages/auth/components/register/register.component.html
+++ b/src/app/pages/auth/components/register/register.component.html
@@ -1,31 +1,33 @@
-
-
+
+
+
-
Register
+
Register
-
+
-
+
+
+
+ Please provide a password.
+
+
+
+
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/app/pages/auth/components/register/register.component.spec.ts b/src/app/pages/auth/components/register/register.component.spec.ts
index a23e135..5dfc701 100644
--- a/src/app/pages/auth/components/register/register.component.spec.ts
+++ b/src/app/pages/auth/components/register/register.component.spec.ts
@@ -5,6 +5,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientModule } from '@angular/common/http';
import { ClarityModule } from '@clr/angular';
+import { SharedModule } from '@shared/shared.module';
describe('RegisterComponent', () => {
let component: RegisterComponent;
@@ -17,6 +18,7 @@ describe('RegisterComponent', () => {
RouterTestingModule,
HttpClientModule,
ClarityModule,
+ SharedModule,
],
declarations: [ RegisterComponent ]
})
diff --git a/src/app/pages/auth/components/register/register.component.ts b/src/app/pages/auth/components/register/register.component.ts
index 06e5c7f..60d9d5e 100644
--- a/src/app/pages/auth/components/register/register.component.ts
+++ b/src/app/pages/auth/components/register/register.component.ts
@@ -41,13 +41,12 @@ export class RegisterComponent {
flatMap(_ => this.returnUrl$),
flatMap(returnUrl => from(this.router.navigateByUrl(returnUrl))))
.subscribe(token => {
- this.registerBtnState = ClrLoadingState.SUCCESS;
- },
- (error: IError) => {
- console.warn('error:', error);
- this.error = error;
- this.registerBtnState = ClrLoadingState.ERROR;
- });
+ this.registerBtnState = ClrLoadingState.SUCCESS;
+ },
+ (error: IError) => {
+ console.warn('error:', error);
+ this.error = error;
+ this.registerBtnState = ClrLoadingState.ERROR;
+ });
}
-
}
diff --git a/src/app/services/authentication/authentication.service.ts b/src/app/services/authentication/authentication.service.ts
index 624823e..82485b1 100644
--- a/src/app/services/authentication/authentication.service.ts
+++ b/src/app/services/authentication/authentication.service.ts
@@ -3,7 +3,7 @@ import { JwtTokenService } from '@services/jwt-token/jwt-token.service';
import { BehaviorSubject, Observable, of } from 'rxjs';
import { BaseClientService } from '@services/base-client/base-client.service';
import { IToken } from '@models/token.model';
-import { map, tap } from 'rxjs/operators';
+import { map, tap, take } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
@@ -23,6 +23,10 @@ export class AuthenticationService {
return this.authSubject.asObservable();
}
+ public get isAuthenticated() {
+ return this.authSubject.value;
+ }
+
public login(email: string, password: string): Observable
{
return this.http.post('auth/login', { email, password })
.pipe(
diff --git a/src/app/shared/components/center-card/center-card.component.html b/src/app/shared/components/center-card/center-card.component.html
new file mode 100644
index 0000000..0450eb9
--- /dev/null
+++ b/src/app/shared/components/center-card/center-card.component.html
@@ -0,0 +1,13 @@
+
+
+
+
diff --git a/src/app/shared/components/center-card/center-card.component.spec.ts b/src/app/shared/components/center-card/center-card.component.spec.ts
new file mode 100644
index 0000000..59a6dd7
--- /dev/null
+++ b/src/app/shared/components/center-card/center-card.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { CenterCardComponent } from './center-card.component';
+
+describe('CenterCardComponent', () => {
+ let component: CenterCardComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ CenterCardComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(CenterCardComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/shared/components/center-card/center-card.component.ts b/src/app/shared/components/center-card/center-card.component.ts
new file mode 100644
index 0000000..552d189
--- /dev/null
+++ b/src/app/shared/components/center-card/center-card.component.ts
@@ -0,0 +1,12 @@
+import { Component, ChangeDetectionStrategy } from '@angular/core';
+
+@Component({
+ selector: 'app-center-card',
+ templateUrl: './center-card.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush
+})
+export class CenterCardComponent {
+
+ constructor() { }
+
+}
diff --git a/src/app/shared/components/header/header.component.html b/src/app/shared/components/header/header.component.html
deleted file mode 100644
index bbcdbf0..0000000
--- a/src/app/shared/components/header/header.component.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/app/shared/components/header/header.component.spec.ts b/src/app/shared/components/header/header.component.spec.ts
deleted file mode 100644
index 71f983d..0000000
--- a/src/app/shared/components/header/header.component.spec.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { HeaderComponent } from './header.component';
-import { HttpClientModule } from '@angular/common/http';
-
-describe('HeaderComponent', () => {
- let component: HeaderComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ HeaderComponent ],
- imports: [
- HttpClientModule
- ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(HeaderComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/src/app/shared/components/header/header.component.ts b/src/app/shared/components/header/header.component.ts
deleted file mode 100644
index e31c974..0000000
--- a/src/app/shared/components/header/header.component.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-import { AuthenticationService } from '@services/authentication/authentication.service';
-
-@Component({
- selector: 'app-header',
- templateUrl: './header.component.html',
-})
-export class HeaderComponent {
-
- constructor(
- public readonly authService: AuthenticationService
- ) { }
-
- public isAuthenticated$ = this.authService.isAuthenticated$;
-
-}
diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts
index 7a3ef93..2775577 100644
--- a/src/app/shared/shared.module.ts
+++ b/src/app/shared/shared.module.ts
@@ -1,16 +1,16 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
-import { HeaderComponent } from './components/header/header.component';
import { ClarityModule } from '@clr/angular';
import { RouterModule } from '@angular/router';
import { WithLoadingPipe } from './pipes/with-loading.pipe';
import { ErrorAlertComponent } from './components/error-alert/error-alert.component';
+import { CenterCardComponent } from './components/center-card/center-card.component';
@NgModule({
declarations: [
- HeaderComponent,
WithLoadingPipe,
ErrorAlertComponent,
+ CenterCardComponent,
],
imports: [
CommonModule,
@@ -18,9 +18,9 @@ import { ErrorAlertComponent } from './components/error-alert/error-alert.compon
RouterModule,
],
exports: [
- HeaderComponent,
WithLoadingPipe,
ErrorAlertComponent,
+ CenterCardComponent,
]
})
export class SharedModule { }