diff --git a/web-ui/src/app/app.module.ts b/web-ui/src/app/app.module.ts index cf1e4b2..46d1fc4 100644 --- a/web-ui/src/app/app.module.ts +++ b/web-ui/src/app/app.module.ts @@ -12,6 +12,7 @@ import { ToastrModule } from 'ngx-toastr'; import { NgHttpLoaderModule } from 'ng-http-loader/ng-http-loader.module' +import { AddressesService } from './services/addresses.service'; import { ErrorService } from './services/error.service'; import { LanguageService } from './services/language.service'; import { NavigatorService } from './services/navigator.service'; @@ -54,6 +55,7 @@ import { AddressDetailsComponent } from './components/address-details/address-de TranslateModule.forRoot(), ], providers: [ + AddressesService, ErrorService, LanguageService, NavigatorService, diff --git a/web-ui/src/app/models/address.ts b/web-ui/src/app/models/address.ts new file mode 100644 index 0000000..f159a78 --- /dev/null +++ b/web-ui/src/app/models/address.ts @@ -0,0 +1,6 @@ + +export class Address { + balance: number; + received: number; + transactionCount: number; +} diff --git a/web-ui/src/app/services/addresses.service.ts b/web-ui/src/app/services/addresses.service.ts new file mode 100644 index 0000000..7c009ae --- /dev/null +++ b/web-ui/src/app/services/addresses.service.ts @@ -0,0 +1,24 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Observable } from 'rxjs/Observable'; + +import { environment } from '../../environments/environment'; + +import { Address } from '../models/address'; + +const httpOptions = { + headers: new HttpHeaders({ 'Content-Type': 'application/json' }) +}; + +@Injectable() +export class AddressesService { + + private baseUrl = environment.api.url + '/addresses'; + + constructor(private http: HttpClient) { } + + get(address: string): Observable
{ + const url = `${this.baseUrl}/${address}`; + return this.http.get(url); + } +}