diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 64a4999..1713593 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -39,13 +39,13 @@ export class AppComponent implements OnInit , OnDestroy {
public onSelect({ item }): void {
if (!item.items) {
this.menuService.itemClicked.emit(item);
- //console.log("emit on select : " + item.text);
+ // console.log("emit on select : " + item.text);
if ( item.popup == "loanEdit"){
this.loanEdit.somedata = "" + Math.random() + "changed";
this.loanEdit.open('dialog');
}
- if (item.text == 'Logout'){
+ if (item.text === 'Logout'){
this.authService.logout();
this.login = false;
// this.authService.loginSuccess.emit("loggedout");
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 8c63558..285f596 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -45,6 +45,7 @@ import { TransDetailsComponent } from './trans-details/trans-details.component';
import { TransTailsComponent } from './trans-details/trans-tails/trans-tails.component';
import {AuthHttpInterceptor} from './auth/auth-http-interceptor.service';
import {WebSocketService} from './websocket';
+import { ChartTypeOfLoansComponent } from './chart-type-of-loans/chart-type-of-loans.component';
@@ -62,7 +63,8 @@ import {WebSocketService} from './websocket';
TransactionListComponent,
RatingComponent,
TransDetailsComponent,
- TransTailsComponent
+ TransTailsComponent,
+ ChartTypeOfLoansComponent
],
imports: [
BrowserModule,
diff --git a/src/app/canvas/canvas.component.html b/src/app/canvas/canvas.component.html
index 50dfb99..cd2d5f2 100644
--- a/src/app/canvas/canvas.component.html
+++ b/src/app/canvas/canvas.component.html
@@ -23,6 +23,7 @@
+
some text
diff --git a/src/app/canvas/canvas.component.ts b/src/app/canvas/canvas.component.ts
index 514eb4c..d32b192 100644
--- a/src/app/canvas/canvas.component.ts
+++ b/src/app/canvas/canvas.component.ts
@@ -1,9 +1,10 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
-import { Subscription } from 'rxjs';
+import {Observable, Subscription} from 'rxjs';
import { sampleProducts } from '../models/sample_product';
import { MenuService } from '../service/menu.service';
import {AuthService} from '../service/auth.service';
import {HttpClient} from '@angular/common/http';
+import {setTime} from '@progress/kendo-angular-dateinputs/dist/es2015/util';
@Component({
selector: 'app-canvas',
@@ -24,6 +25,7 @@ export class CanvasComponent implements OnInit, OnDestroy {
console.log(item);
}
);
+
}
ngOnDestroy(): void{
this.menutItemSub.unsubscribe();
@@ -43,4 +45,5 @@ export class CanvasComponent implements OnInit, OnDestroy {
}
+
}
diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html
index b534123..380220a 100644
--- a/src/app/dashboard/dashboard.component.html
+++ b/src/app/dashboard/dashboard.component.html
@@ -7,24 +7,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -32,16 +15,16 @@
+ [title]="{ text: 'type' }">
-
+
-
+
-
+
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts
index 8a6e924..588f939 100644
--- a/src/app/dashboard/dashboard.component.ts
+++ b/src/app/dashboard/dashboard.component.ts
@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { sampleProducts } from '../models/sample_product';
import {AuthService} from '../service/auth.service';
+import {Observable} from 'rxjs';
@@ -16,7 +17,9 @@ export class DashboardComponent implements OnInit {
constructor() { }
ngOnInit(): void {
+
}
+
}
diff --git a/src/app/models/type-of-loans.model.ts b/src/app/models/type-of-loans.model.ts
new file mode 100644
index 0000000..3844fa2
--- /dev/null
+++ b/src/app/models/type-of-loans.model.ts
@@ -0,0 +1,6 @@
+
+
+export class TypeOfLoansModel{
+ kind: string;
+ share: number;
+}
diff --git a/src/app/service/auth.service.ts b/src/app/service/auth.service.ts
index bdf6b4f..8ac1900 100644
--- a/src/app/service/auth.service.ts
+++ b/src/app/service/auth.service.ts
@@ -60,31 +60,41 @@ export class AuthService {
}
);
-
- // const promise = new Promise(
- // (resolve, reject) => {
- // setTimeout(() => {
- // resolve(this.loggedIn);
- // console.log('email = ' + email + ' password = ' + password);
- // const result = (( email === 'email@email.com' ) && (password === 'password'));
- // this.loggedIn = result;
- // this.loginSuccess.emit(result);
- // }, 800);
- // }
- // );
- // return promise;
-
}
// tslint:disable-next-line:typedef
logout() {
- console.log('trying to log out');
- this.loggedIn = new apiV1LoginResponse(false,'','',0);
- localStorage.removeItem('sfm');
- this.loginSuccess.emit(this.loggedIn);
- this.router.navigate(['/login']);
-
+ this.loggedIn = new apiV1LoginResponse(false,'','',0);
+ localStorage.removeItem('sfm');
+ this.loginSuccess.emit(this.loggedIn);
+ this.router.navigate(['/login']).then(r =>{
+ console.log('prepare to log back in');
+ } );
+ this.http.post(`${this.apiUrl}logout`, '').subscribe(
+ resp => {
+ console.log('successfully logout from server');
+ },
+ event => {
+ console.log('error logout from server', event);
+ }
+ );
}
-}
+ // tslint:disable-next-line:variable-name
+ public getUrl(key: string): string{
+ const s = this.apiUrl + key;
+ const kvPair: {key: string, value: string}[] = [
+ {key: 'login', value: this.apiUrl + 'login'},
+ {key: 'logout', value: this.apiUrl + 'logout'}
+ ];
+
+ kvPair.forEach( item => {
+ if ( item.key === key) {
+ return item.value;
+ }
+ });
+
+ // not found if arrive here
+ return s;
+ }}