diff --git a/src/app/app.component.html b/src/app/app.component.html index 0e03fe9..5de160c 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -14,6 +14,10 @@
+ +
+ + +
+
warnYou are not logged in.
+ +
+ diff --git a/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.scss b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.spec.ts b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.spec.ts new file mode 100644 index 0000000..364e28b --- /dev/null +++ b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserProfileDialogComponent } from './user-profile-dialog.component'; + +describe('UserProfileDialogComponent', () => { + let component: UserProfileDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ UserProfileDialogComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserProfileDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.ts b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.ts new file mode 100644 index 0000000..17d8c86 --- /dev/null +++ b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.ts @@ -0,0 +1,28 @@ +import { Component, OnInit } from '@angular/core'; +import { PostsService } from 'app/posts.services'; +import { Router } from '@angular/router'; +import { MatDialogRef } from '@angular/material/dialog'; + +@Component({ + selector: 'app-user-profile-dialog', + templateUrl: './user-profile-dialog.component.html', + styleUrls: ['./user-profile-dialog.component.scss'] +}) +export class UserProfileDialogComponent implements OnInit { + + constructor(public postsService: PostsService, private router: Router, public dialogRef: MatDialogRef) { } + + ngOnInit(): void { + } + + loginClicked() { + this.router.navigate(['/login']); + this.dialogRef.close(); + } + + logoutClicked() { + this.postsService.logout(); + this.dialogRef.close(); + } + +}