1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { Component, OnInit } from '@angular/core';
- import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
- import { JhiEventManager } from 'ng-jhipster';
-
- import { LoginModalService, Principal, Account } from 'app/core';
-
- @Component({
- selector: 'jhi-home',
- templateUrl: './home.component.html',
- styleUrls: ['home.scss']
- })
- export class HomeComponent implements OnInit {
- account: Account;
- modalRef: NgbModalRef;
-
- constructor(private principal: Principal, private loginModalService: LoginModalService, private eventManager: JhiEventManager) {}
-
- ngOnInit() {
- this.principal.identity().then(account => {
- this.account = account;
- });
- this.registerAuthenticationSuccess();
- }
-
- registerAuthenticationSuccess() {
- this.eventManager.subscribe('authenticationSuccess', message => {
- this.principal.identity().then(account => {
- this.account = account;
- });
- });
- }
-
- isAuthenticated() {
- return this.principal.isAuthenticated();
- }
-
- login() {
- this.modalRef = this.loginModalService.open();
- }
- }
|