Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Component({
- selector: 'ddi-login-page',
- templateUrl: 'login-page.component.html'
- })
- export class LoginPageComponent implements OnInit {
- user: User;
- constructor(private userService: UserService,
- private routingService: RoutingService) {
- }
- ngOnInit() {
- this.user = User.instance();
- // mock data
- this.user.username = 'admin';
- this.user.password = 'admin123';
- }
- login() {
- this.userService.login(this.user.username, this.user.password)
- .then(res => {
- const urlToGoAfterLogin = this.routingService.lastPageUrl;
- if (urlToGoAfterLogin) {
- this.routingService.goTo(urlToGoAfterLogin);
- } else {
- this.routingService.goToMenuPage();
- }
- this.routingService.lastPageUrl = '';
- });
- }
- logout() {
- this.userService.logout();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement