Quellcode durchsuchen

🤡 mock getUserBalance()

jmacura vor 3 Jahren
Ursprung
Commit
5300ce2a47

+ 1 - 1
src/app/bc-info/bc-info.component.html

@@ -1,3 +1,3 @@
-My account balance: $$
+My account balance: {{getUserBalance()}}$$
 <br>
 Price: $$

+ 6 - 1
src/app/bc-info/bc-info.component.ts

@@ -1,4 +1,5 @@
 import {Component, OnInit} from '@angular/core';
+import {BcInfoService} from './bc-info.service';
 
 @Component({
   selector: 'blockchain-info',
@@ -6,7 +7,11 @@ import {Component, OnInit} from '@angular/core';
 })
 
 export class BcInfoComponent implements OnInit {
-  constructor() {}
+  constructor(public bcInfoService: BcInfoService) {}
 
   ngOnInit() {}
+
+  getUserBalance() {
+    return this.bcInfoService.getUserBalance();
+  }
 }

+ 9 - 2
src/app/bc-info/bc-info.service.ts

@@ -1,7 +1,14 @@
-import { Injectable } from '@angular/core';
+import {Injectable} from '@angular/core';
+import {HttpClient} from '@angular/common/http';
 
 @Injectable({providedIn: 'root'})
 export class BcInfoService {
-  constructor() {}
+  BASE_URL = 'https://chain4all.lesprojekt.cz' as const;
+  user = 'jmacura';
+  user_balance = -1;
+  constructor(public httpClient: HttpClient) {}
   
+  getUserBalance() {
+    //TODO:
+  }
 }