diff options
Diffstat (limited to 'ufund-ui/src/app/components')
-rw-r--r-- | ufund-ui/src/app/components/login/login.component.html | 8 | ||||
-rw-r--r-- | ufund-ui/src/app/components/login/login.component.ts | 14 |
2 files changed, 17 insertions, 5 deletions
diff --git a/ufund-ui/src/app/components/login/login.component.html b/ufund-ui/src/app/components/login/login.component.html index 41427ae..178ddbf 100644 --- a/ufund-ui/src/app/components/login/login.component.html +++ b/ufund-ui/src/app/components/login/login.component.html @@ -1,5 +1,5 @@ <p>Login:</p> -<input placeholder="Username" type="text"> -<input placeholder="Password" type="password"> -<button>Login</button> -<button>Create Account...</button> +<input placeholder="Username" type="text" #username> +<input placeholder="Password" type="password" #password> +<button type="button" (click)="login(username.value, password.value)">Login</button> +<button type="button">Create Account...</button> diff --git a/ufund-ui/src/app/components/login/login.component.ts b/ufund-ui/src/app/components/login/login.component.ts index efb8a58..9a4eb0f 100644 --- a/ufund-ui/src/app/components/login/login.component.ts +++ b/ufund-ui/src/app/components/login/login.component.ts @@ -1,4 +1,5 @@ -import { Component } from '@angular/core'; +import { Component } from '@angular/core' +import {UsersService} from '../../services/users.service'; @Component({ selector: 'app-login', @@ -7,5 +8,16 @@ import { Component } from '@angular/core'; styleUrl: './login.component.css' }) export class LoginComponent { + constructor( + protected usersService: UsersService + ) {} + 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) + } } |