瀏覽代碼

🤡 mock getUserBalance()

jmacura 3 年之前
父節點
當前提交
5300ce2a47
共有 3 個文件被更改,包括 16 次插入4 次删除
  1. 1 1
      src/app/bc-info/bc-info.component.html
  2. 6 1
      src/app/bc-info/bc-info.component.ts
  3. 9 2
      src/app/bc-info/bc-info.service.ts

+ 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:
+  }
 }