Delete unused component
This commit is contained in:
@@ -1,22 +0,0 @@
|
|||||||
<div class="container col-lg-6">
|
|
||||||
<h1 class="text-center">Login</h1>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<form class="form-group">
|
|
||||||
<div class="alert alert-warning" *ngIf='invalidLogin'>{{errorMessage}}</div>
|
|
||||||
<div class="alert alert-success" *ngIf='loginSuccess'>{{successMessage}}</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="email">User Name :</label>
|
|
||||||
<input type="text" class="form-control" id="username" [(ngModel)]="username" placeholder="Enter User Name"
|
|
||||||
name="username">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="pwd">Password:</label>
|
|
||||||
<input type="password" class="form-control" [(ngModel)]="password" id="password" placeholder="Enter password"
|
|
||||||
name="password">
|
|
||||||
</div>
|
|
||||||
<button (click)=handleLogin() class="btn btn-success">Login</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { LoginComponent } from './login.component';
|
|
||||||
|
|
||||||
describe('LoginComponent', () => {
|
|
||||||
let component: LoginComponent;
|
|
||||||
let fixture: ComponentFixture<LoginComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ LoginComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(LoginComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
|
||||||
import { AuthenticationService } from 'src/app/services/auth.service';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-login',
|
|
||||||
templateUrl: './login.component.html',
|
|
||||||
styleUrls: ['./login.component.scss'],
|
|
||||||
})
|
|
||||||
export class LoginComponent implements OnInit {
|
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
errorMessage = 'Invalid Credentials';
|
|
||||||
successMessage: string;
|
|
||||||
invalidLogin = false;
|
|
||||||
loginSuccess = false;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private route: ActivatedRoute,
|
|
||||||
private router: Router,
|
|
||||||
private authenticationService: AuthenticationService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit() {}
|
|
||||||
|
|
||||||
handleLogin() {
|
|
||||||
this.authenticationService
|
|
||||||
.authenticationService(this.username, this.password)
|
|
||||||
.subscribe(
|
|
||||||
(result) => {
|
|
||||||
this.invalidLogin = false;
|
|
||||||
this.loginSuccess = true;
|
|
||||||
this.successMessage = 'Login Successful.';
|
|
||||||
this.router.navigate(['/dashboard']);
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this.invalidLogin = true;
|
|
||||||
this.loginSuccess = false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user