Преглед на файлове

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