mirror of
https://gitlab.com/openlp/web-remote.git
synced 2024-12-22 11:32:47 +00:00
Refactor login component.
This commit is contained in:
parent
ece665dbf2
commit
75c11d4543
@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { MatDialogRef } from '@angular/material/dialog';
|
import { MatDialogRef } from '@angular/material/dialog';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
@ -10,7 +10,7 @@ import { OpenLPService } from '../../openlp.service';
|
|||||||
templateUrl: './login.component.html',
|
templateUrl: './login.component.html',
|
||||||
styleUrl: './login.component.scss'
|
styleUrl: './login.component.scss'
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit {
|
export class LoginComponent {
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
loginSucceededMessage: string;
|
loginSucceededMessage: string;
|
||||||
@ -29,17 +29,13 @@ export class LoginComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
performLogin() {
|
performLogin() {
|
||||||
this.openlpService.login({username: this.username, password: this.password}).subscribe(
|
this.openlpService.login({ username: this.username, password: this.password }).subscribe({
|
||||||
result => {
|
next: result => {
|
||||||
this.snackBar.open(this.loginSucceededMessage, '', {duration: 2000});
|
this.snackBar.open(this.loginSucceededMessage, '', { duration: 2000 });
|
||||||
this.dialogRef.close(result);
|
this.dialogRef.close(result);
|
||||||
},
|
},
|
||||||
() => this.snackBar.open(this.loginFailedMessage, '', {duration: 2000})
|
error: () => this.snackBar.open(this.loginFailedMessage, '', { duration: 2000 })
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user