refractor: home module (#297)

* Refractor components.
* Redesign home component.
* Add comments.

Fixes #296
This commit is contained in:
Abhay Chawla
2018-08-12 20:46:54 +05:30
committed by GitHub
parent b54e2a2b01
commit 598f239251
16 changed files with 98 additions and 511 deletions
+17 -10
View File
@@ -1,9 +1,12 @@
/** Angular Imports */
import { Component, OnInit } from '@angular/core';
import { finalize } from 'rxjs/operators';
import { QuoteService } from './quote.service';
/** Custom Services */
import { AuthenticationService } from '../core/authentication/authentication.service';
/**
* Home component.
*/
@Component({
selector: 'mifosx-home',
templateUrl: './home.component.html',
@@ -11,16 +14,20 @@ import { QuoteService } from './quote.service';
})
export class HomeComponent implements OnInit {
quote: string;
isLoading: boolean;
/** Username of authenticated user. */
username: string;
constructor(private quoteService: QuoteService) { }
/**
* @param {AuthenticationService} authenticationService Authentication Service.
*/
constructor(private authenticationService: AuthenticationService) { }
/**
* Sets the username of the authenticated user.
*/
ngOnInit() {
this.isLoading = true;
// this.quoteService.getRandomQuote({ category: 'dev' })
// .pipe(finalize(() => { this.isLoading = false; }))
// .subscribe((quote: string) => { this.quote = quote; });
const credentials = this.authenticationService.getCredentials();
this.username = credentials.username;
}
}