X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=blueprints%2Fcommon%2Feliot-ui%2Ffrontend-src%2Fsrc%2Fapp%2Flogin%2Flogin.component.ts;fp=blueprints%2Fcommon%2Feliot-ui%2Ffrontend-src%2Fsrc%2Fapp%2Flogin%2Flogin.component.ts;h=0000000000000000000000000000000000000000;hb=434326c60fb0434bda587102b4746173fe425dea;hp=155e28bfb23fbb07005fb30f7fbbe8a0a7f146ed;hpb=37827e492060182b32df67c2a538a29808fa5e17;p=eliot.git diff --git a/blueprints/common/eliot-ui/frontend-src/src/app/login/login.component.ts b/blueprints/common/eliot-ui/frontend-src/src/app/login/login.component.ts deleted file mode 100644 index 155e28b..0000000 --- a/blueprints/common/eliot-ui/frontend-src/src/app/login/login.component.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; -// import { ToolbarService } from './../toolbar/toolbar.service'; - -import { Router, ActivatedRoute } from '@angular/router'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; - -import { AuthenticationService } from '../_services/authentication.service'; -import { EliotserviceService } from '../eliotservice.service'; -declare var particlesJS: any; - -@Component({ - selector: 'app-login', - templateUrl: './login.component.html', - styleUrls: ['./login.component.scss'] -}) -export class LoginComponent implements OnInit { - - - loginForm: FormGroup; - loading = false; - submitted = false; - returnUrl: string; - hide = true; - - roles = { - role:'ADMIN' - } - - constructor( - private formBuilder: FormBuilder, - private route: ActivatedRoute, - private router: Router, - private authenticationService: AuthenticationService, - private eliotService: EliotserviceService - - ) { } - - ngOnInit() { - debugger; - - this.loginForm = this.formBuilder.group({ - email: ['', Validators.required], - password: ['', Validators.required] - }); - - particlesJS.load('particles-js', './../../assets/particlesjs-config.json', function() { - console.log('callback - particles.js config loaded'); - }); - } - - get fval() { return this.loginForm.controls; } - - onFormSubmit() { - console.log("Inside onFormSubmit() ....") - this.submitted = true; - if (this.loginForm.invalid) { - console.log("Login Form invalid...") - return; - } - this.loading = true; - - // mock role - this.eliotService.getRoleName() - .subscribe( - data => { - console.log(data); - sessionStorage.setItem('roleName',data.roleName); - } - ); - this.router.navigate(['/']); - - this.authenticationService.login(this.fval.email.value, this.fval.password.value) - .subscribe( - data => { - sessionStorage.setItem('roleName',this.roles.role); - this.router.navigate(['/']); - }, - error => { - this.loading = false; - }); - } - -}