aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/login
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-ui/src/app/components/login')
-rw-r--r--ufund-ui/src/app/components/login/login.component.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/ufund-ui/src/app/components/login/login.component.ts b/ufund-ui/src/app/components/login/login.component.ts
index 4dcaedd..0177f67 100644
--- a/ufund-ui/src/app/components/login/login.component.ts
+++ b/ufund-ui/src/app/components/login/login.component.ts
@@ -1,8 +1,8 @@
import {Component, OnInit} from '@angular/core'
import {UsersService} from '../../services/users.service';
import {ActivatedRoute, Router} from '@angular/router';
-import {BehaviorSubject} from 'rxjs';
import {AuthService} from '../../services/auth.service';
+import {ToastsService, ToastType} from '../../services/toasts.service';
@Component({
selector: 'app-login',
@@ -13,13 +13,13 @@ import {AuthService} from '../../services/auth.service';
export class LoginComponent implements OnInit {
protected next?: string | null;
- protected statusText = new BehaviorSubject("")
constructor(
protected usersService: UsersService,
protected router: Router,
private route: ActivatedRoute,
- private authService: AuthService
+ private authService: AuthService,
+ private toastService: ToastsService
) {}
ngOnInit() {
@@ -38,7 +38,7 @@ export class LoginComponent implements OnInit {
let key = this.authService.getApiKey()
localStorage.setItem("credential", JSON.stringify({username: username, key: key}))
}).catch(ex => {
- this.statusText.next("Unable to login: " + friendlyHttpStatus[ex.status])
+ this.toastService.sendToast(ToastType.ERROR, "Unable to login: " + friendlyHttpStatus[ex.status])
console.log(ex)
})
}
@@ -50,9 +50,9 @@ export class LoginComponent implements OnInit {
}
this.usersService.createUser(username, password).then(() => {
- this.statusText.next("Account created, click login.")
+ this.toastService.sendToast(ToastType.INFO, "Account created, click login.")
}).catch(ex => {
- this.statusText.next("Unable to create account: " + friendlyHttpStatus[ex.status])
+ this.toastService.sendToast(ToastType.ERROR, "Unable to create account: " + friendlyHttpStatus[ex.status])
console.log(ex)
})
}