aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/login/login.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-ui/src/app/components/login/login.component.ts')
-rw-r--r--ufund-ui/src/app/components/login/login.component.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/ufund-ui/src/app/components/login/login.component.ts b/ufund-ui/src/app/components/login/login.component.ts
index efb8a58..50dd018 100644
--- a/ufund-ui/src/app/components/login/login.component.ts
+++ b/ufund-ui/src/app/components/login/login.component.ts
@@ -1,4 +1,6 @@
-import { Component } from '@angular/core';
+import { Component } from '@angular/core'
+import {UsersService} from '../../services/users.service';
+import {Router} from '@angular/router';
@Component({
selector: 'app-login',
@@ -7,5 +9,19 @@ import { Component } from '@angular/core';
styleUrl: './login.component.css'
})
export class LoginComponent {
+ constructor(
+ protected usersService: UsersService,
+ private router: Router
+ ) {}
+ login(username: string | null, password: string | null) {
+ console.log(`attempting to log in with ${username} ${password}`)
+ if (!username || !password) {
+ return;
+ }
+
+ this.usersService.login(username, password).then(() => {
+ this.router.navigate(['/dashboard']);
+ })
+ }
}