diff options
| author | crupest <crupest@outlook.com> | 2019-03-18 21:21:56 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2019-03-18 21:21:56 +0800 |
| commit | 110f2ab8d7bf5cf5fefee2fadb89f0e548dc0f4d (patch) | |
| tree | 43b4694b7b1626b746f56d3937c1f58a4b8f15fb /Timeline/ClientApp/src/app/user/user-logout | |
| parent | 442d784b2a3ed0c8f0c64d1aaae2b1e0fbefe01f (diff) | |
| download | timeline-110f2ab8d7bf5cf5fefee2fadb89f0e548dc0f4d.tar.gz timeline-110f2ab8d7bf5cf5fefee2fadb89f0e548dc0f4d.tar.bz2 timeline-110f2ab8d7bf5cf5fefee2fadb89f0e548dc0f4d.zip | |
Add logout. Fix a bug.
The bug is it always goes to login page whether you have login or not before when user is presented in url.
Diffstat (limited to 'Timeline/ClientApp/src/app/user/user-logout')
4 files changed, 43 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.css b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.css new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.css diff --git a/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.html b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.html new file mode 100644 index 00000000..56d96b83 --- /dev/null +++ b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.html @@ -0,0 +1 @@ +<p class="mat-body">Log out succeeded!</p> diff --git a/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts new file mode 100644 index 00000000..91369e01 --- /dev/null +++ b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserLogoutComponent } from './user-logout.component'; + +describe('UserLogoutComponent', () => { + let component: UserLogoutComponent; + let fixture: ComponentFixture<UserLogoutComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ UserLogoutComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserLogoutComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.ts b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.ts new file mode 100644 index 00000000..24002c84 --- /dev/null +++ b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.ts @@ -0,0 +1,17 @@ +import { Component, OnInit } from '@angular/core'; +import { InternalUserService } from '../internal-user-service/internal-user.service'; + +@Component({ + selector: 'app-user-logout', + templateUrl: './user-logout.component.html', + styleUrls: ['./user-logout.component.css'] +}) +export class UserLogoutComponent implements OnInit { + + constructor(private userService: InternalUserService) { } + + ngOnInit() { + this.userService.logout(); + } + +} |
