Modify services to use new API endpoints
This commit is contained in:
parent
8628f79043
commit
28012ee2a9
11 changed files with 96 additions and 85 deletions
|
@ -1,5 +1,7 @@
|
||||||
# ZGo - The Zcash Register
|
# ZGo - The Zcash Register
|
||||||
|
|
||||||
|
[![Please don't upload to GitHub](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page)
|
||||||
|
|
||||||
A Point-of-Sale application for accepting payments in [Zcash](https://z.cash/)
|
A Point-of-Sale application for accepting payments in [Zcash](https://z.cash/)
|
||||||
|
|
||||||
Visit our [ZGo Homepage](https://zgo.cash/) for more details.
|
Visit our [ZGo Homepage](https://zgo.cash/) for more details.
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { LanguageService } from './language.service';
|
import { LanguageService } from './language.service';
|
||||||
import { LanguageData } from './language.model';
|
|
||||||
|
|
||||||
//import { Post} from './posts/post.model';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { Injectable } from '@angular/core';
|
||||||
import { Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';
|
import { Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';
|
||||||
import {HttpClient, HttpParams} from '@angular/common/http';
|
import {HttpClient, HttpParams} from '@angular/common/http';
|
||||||
import { UserService } from './user.service';
|
import { UserService } from './user.service';
|
||||||
import { Subscription, Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
||||||
|
@ -12,44 +13,39 @@ export class AuthGuardService {
|
||||||
private paidUpdate: Observable<boolean>;
|
private paidUpdate: Observable<boolean>;
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private http: HttpClient,
|
|
||||||
public userService: UserService
|
public userService: UserService
|
||||||
){
|
){
|
||||||
|
this.userService.findUser();
|
||||||
this.paidUpdate = this.userService.paidUpdate;
|
this.paidUpdate = this.userService.paidUpdate;
|
||||||
this.paidUpdate.subscribe((indicator) => {
|
this.paidUpdate.subscribe((indicator) => {
|
||||||
this.paid = indicator;
|
this.paid = indicator;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||||
const token = localStorage.getItem('s4z_token');
|
const token = localStorage.getItem('s4z_token');
|
||||||
|
|
||||||
var path = route.url[0].path;
|
var path = route.url[0].path;
|
||||||
|
|
||||||
if(token != null){
|
if(token != null){
|
||||||
this.userService.uZaddrUpdate.
|
if (path === 'biz') {
|
||||||
subscribe((addr) => {
|
this.userService.checkUser()?.subscribe( response => {
|
||||||
if (addr != null) {
|
if (response.status == 200 && response.body?.validated) {
|
||||||
//console.log(addr);
|
return true;
|
||||||
this.addr = addr;
|
|
||||||
} else {
|
} else {
|
||||||
console.log("No record for that token");
|
this.router.navigate(['/login']);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (path === 'biz') {
|
} else {
|
||||||
if (this.addr.length > 0) {
|
this.userService.checkUser()?.subscribe( response => {
|
||||||
return true;
|
if (response.status == 200 && response.body?.validated && this.paid) {
|
||||||
} else {
|
|
||||||
this.router.navigate(['/login']);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (this.addr != null && this.paid) {
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Not logged in");
|
console.log("Not logged in");
|
||||||
|
|
|
@ -57,7 +57,7 @@ export class FullnodeService{
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeight(){
|
getHeight(){
|
||||||
let obs = this.http.get<{message: string, height: number}>(this.beUrl+'api/blockheight', { headers: this.reqHeaders, params: this.params });
|
let obs = this.http.get<{message: string, height: number}>(this.beUrl+'blockheight', { headers: this.reqHeaders, params: this.params });
|
||||||
obs.subscribe((BlockData) => {
|
obs.subscribe((BlockData) => {
|
||||||
this.dataStore.height = BlockData.height;
|
this.dataStore.height = BlockData.height;
|
||||||
this._heightUpdated.next(Object.assign({}, this.dataStore).height);
|
this._heightUpdated.next(Object.assign({}, this.dataStore).height);
|
||||||
|
@ -69,7 +69,7 @@ export class FullnodeService{
|
||||||
getPrice(currency: string){
|
getPrice(currency: string){
|
||||||
//var currency = 'usd';
|
//var currency = 'usd';
|
||||||
const params = this.params.append('currency', currency);
|
const params = this.params.append('currency', currency);
|
||||||
let obs = this.http.get<{message: string, price: any}>(this.beUrl+'api/price', { headers:this.reqHeaders, params: params, observe: 'response'});
|
let obs = this.http.get<{message: string, price: any}>(this.beUrl+'price', { headers:this.reqHeaders, params: params, observe: 'response'});
|
||||||
obs.subscribe((PriceData) => {
|
obs.subscribe((PriceData) => {
|
||||||
if (PriceData.status == 200) {
|
if (PriceData.status == 200) {
|
||||||
this.dataStore.price = PriceData.body!.price.price;
|
this.dataStore.price = PriceData.body!.price.price;
|
||||||
|
@ -84,7 +84,7 @@ export class FullnodeService{
|
||||||
}
|
}
|
||||||
|
|
||||||
getAddr() {
|
getAddr() {
|
||||||
let obs = this.http.get<{message: string, addr: string}>(this.beUrl+'api/getaddr', { headers: this.reqHeaders, params: this.params });
|
let obs = this.http.get<{message: string, addr: string}>(this.beUrl+'getaddr', { headers: this.reqHeaders, params: this.params });
|
||||||
|
|
||||||
obs.subscribe((AddrData) => {
|
obs.subscribe((AddrData) => {
|
||||||
this.dataStore.addr = AddrData.addr;
|
this.dataStore.addr = AddrData.addr;
|
||||||
|
|
|
@ -19,6 +19,9 @@ export class LanguageService {
|
||||||
//
|
//
|
||||||
// URL for access MongoDB database from remote server
|
// URL for access MongoDB database from remote server
|
||||||
private baseURL = ConfigData.Be_URL + 'api/getlang';
|
private baseURL = ConfigData.Be_URL + 'api/getlang';
|
||||||
|
private loginURL = ConfigData.Be_URL + 'getloginlang';
|
||||||
|
private mainURL = ConfigData.Be_URL + 'getmainlang';
|
||||||
|
private scanURL = ConfigData.Be_URL + 'getscanlang';
|
||||||
|
|
||||||
public zgoLanguage: string = '';
|
public zgoLanguage: string = '';
|
||||||
|
|
||||||
|
@ -49,6 +52,13 @@ export class LanguageService {
|
||||||
// Get component's text data from language database
|
// Get component's text data from language database
|
||||||
//
|
//
|
||||||
const params = new HttpParams().append('session', this.session!);
|
const params = new HttpParams().append('session', this.session!);
|
||||||
|
if (viewName === 'login') {
|
||||||
|
return this.http.get<LanguageData>(this.loginURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
||||||
|
} else if (viewName === 'main') {
|
||||||
|
return this.http.get<LanguageData>(this.mainURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
||||||
|
} else if (viewName === 'scan') {
|
||||||
|
return this.http.get<LanguageData>(this.scanURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
||||||
|
} else {
|
||||||
return this.http.get<LanguageData>(this.baseURL +
|
return this.http.get<LanguageData>(this.baseURL +
|
||||||
'/?lang=' + this.zgoLanguage +
|
'/?lang=' + this.zgoLanguage +
|
||||||
'&component=' + viewName
|
'&component=' + viewName
|
||||||
|
@ -58,3 +68,4 @@ export class LanguageService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
public uZaddrUpdate: Observable<string>;
|
public uZaddrUpdate: Observable<string>;
|
||||||
public userUpdate: Observable<User>;
|
public userUpdate: Observable<User>;
|
||||||
public ownerUpdate: Observable<Owner>;
|
public ownerUpdate: Observable<Owner>;
|
||||||
public txsUpdate: Observable<Tx[]>;
|
//public txsUpdate: Observable<Tx[]>;
|
||||||
prompt: boolean = false;
|
prompt: boolean = false;
|
||||||
confirmedMemo: boolean = false;
|
confirmedMemo: boolean = false;
|
||||||
targetBlock: number = 0;
|
targetBlock: number = 0;
|
||||||
|
@ -65,7 +65,6 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
barMessage = 'Scanning blockchain for login memo, please wait.';
|
barMessage = 'Scanning blockchain for login memo, please wait.';
|
||||||
@ViewChild('stepper') private myStepper?: MatStepper;
|
@ViewChild('stepper') private myStepper?: MatStepper;
|
||||||
|
|
||||||
entryForm: UntypedFormGroup;
|
|
||||||
pinForm: UntypedFormGroup;
|
pinForm: UntypedFormGroup;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -95,9 +94,6 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
){
|
){
|
||||||
|
|
||||||
//this.fullnodeService.getAddr();
|
//this.fullnodeService.getAddr();
|
||||||
this.entryForm = fb.group({
|
|
||||||
selectedSession: [0.001, Validators.required]
|
|
||||||
});
|
|
||||||
this.pinForm = fb.group({
|
this.pinForm = fb.group({
|
||||||
pinValue: [null, Validators.required]
|
pinValue: [null, Validators.required]
|
||||||
});
|
});
|
||||||
|
@ -111,10 +107,10 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
this.ownerUpdate.subscribe((owner) => {
|
this.ownerUpdate.subscribe((owner) => {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
});
|
});
|
||||||
this.txsUpdate = userService.txUpdate;
|
//this.txsUpdate = userService.txUpdate;
|
||||||
this.txsUpdate.subscribe((txs) => {
|
//this.txsUpdate.subscribe((txs) => {
|
||||||
this.txs = txs;
|
//this.txs = txs;
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(){
|
ngAfterViewInit(){
|
||||||
|
@ -141,16 +137,16 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
this.chgUILanguage();
|
this.chgUILanguage();
|
||||||
this.intervalHolder = setInterval(() => {
|
this.intervalHolder = setInterval(() => {
|
||||||
this.fullnodeService.getHeight();
|
this.fullnodeService.getHeight();
|
||||||
//this.userService.findUser();
|
|
||||||
this.loginCheck();
|
this.loginCheck();
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
}, 1000 * 60);
|
}, 1000 * 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
loginCheck(){
|
loginCheck(){
|
||||||
this.userService.findUser();
|
this.userService.checkUser()!.subscribe({
|
||||||
this.userUpdate.subscribe((user) => {
|
next: (checkResponse) => {
|
||||||
if (user.blocktime > 0) {
|
if (checkResponse.status == 200) {
|
||||||
|
console.log('checkUser true');
|
||||||
if(this.myStepper!.selectedIndex === 0) {
|
if(this.myStepper!.selectedIndex === 0) {
|
||||||
this.myStepper!.next();
|
this.myStepper!.next();
|
||||||
this.myStepper!.next();
|
this.myStepper!.next();
|
||||||
|
@ -159,16 +155,17 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||||
this.myStepper!.next();
|
this.myStepper!.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log('Log in found in blockchain!');
|
if(checkResponse.body!.validated) {
|
||||||
if (user.validated) {
|
console.log('redirecting to biz');
|
||||||
clearInterval(this.intervalHolder);
|
this.userService.getOwner();
|
||||||
if (this.owner.paid) {
|
|
||||||
this.router.navigate(['/shop']);
|
|
||||||
} else {
|
|
||||||
this.router.navigate(['/biz']);
|
this.router.navigate(['/biz']);
|
||||||
|
clearInterval(this.intervalHolder);
|
||||||
|
} else {
|
||||||
|
console.log('validated failed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
error: (error) => {console.log(error);}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ export class ReceiptService {
|
||||||
if (OrderDataResponse.status == 200) {
|
if (OrderDataResponse.status == 200) {
|
||||||
this.dataStore.order = OrderDataResponse.body!.order;
|
this.dataStore.order = OrderDataResponse.body!.order;
|
||||||
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
||||||
this.userService.getOwner(this.dataStore.order.address);
|
this.userService.getOwner();
|
||||||
this.ownerUpdate.subscribe((owner) => {
|
this.ownerUpdate.subscribe((owner) => {
|
||||||
this.dataStore.owner = owner;
|
this.dataStore.owner = owner;
|
||||||
this._nameUpdated.next(Object.assign({}, this.dataStore).owner.name);
|
this._nameUpdated.next(Object.assign({}, this.dataStore).owner.name);
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
||||||
import { NotifierService } from '../notifier.service';
|
import { NotifierService } from '../notifier.service';
|
||||||
|
|
||||||
import { LanguageService } from '../language.service';
|
import { LanguageService } from '../language.service';
|
||||||
import { LanguageData } from '../language.model';
|
|
||||||
|
|
||||||
var QRCode = require('easyqrcodejs');
|
var QRCode = require('easyqrcodejs');
|
||||||
var URLSafeBase64 = require('urlsafe-base64');
|
var URLSafeBase64 = require('urlsafe-base64');
|
||||||
|
@ -148,13 +147,14 @@ export class ScanComponent implements OnInit{
|
||||||
}
|
}
|
||||||
|
|
||||||
chgUILanguage(){
|
chgUILanguage(){
|
||||||
console.log('SCAN.chgUILanguage Called ');
|
//console.log('SCAN.chgUILanguage Called ');
|
||||||
this.languageService.getViewElements('scan').subscribe(
|
this.languageService.getViewElements('scan').subscribe({
|
||||||
|
next:
|
||||||
response => {
|
response => {
|
||||||
console.log('Received >> ', response );
|
//console.log('Received >> ', response );
|
||||||
console.log('Language Code : ', response.language);
|
//console.log('Language Code : ', response.language);
|
||||||
console.log('Component Name : ',response.component);
|
//console.log('Component Name : ',response.component);
|
||||||
console.log('Language data : ',response.data);
|
//console.log('Language data : ',response.data);
|
||||||
|
|
||||||
this.vE.scanScanqrCode = response.data.scan_scanqr_code;
|
this.vE.scanScanqrCode = response.data.scan_scanqr_code;
|
||||||
this.vE.scanTextInfo = response.data.scan_text_info;
|
this.vE.scanTextInfo = response.data.scan_text_info;
|
||||||
|
@ -172,8 +172,8 @@ export class ScanComponent implements OnInit{
|
||||||
this.vE.scanOrButton = response.data.scan_or_button;
|
this.vE.scanOrButton = response.data.scan_or_button;
|
||||||
|
|
||||||
},
|
},
|
||||||
error => { console.log('Error >> ',error); }
|
error: error => { console.log('Error >> ',error); }
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import { NotifierService } from './notifier.service';
|
||||||
import { User } from './user.model';
|
import { User } from './user.model';
|
||||||
import { Owner } from './owner.model';
|
import { Owner } from './owner.model';
|
||||||
import { Country } from './country.model';
|
import { Country } from './country.model';
|
||||||
import { Tx } from './tx.model';
|
|
||||||
|
|
||||||
import { ConfigData } from './configdata';
|
import { ConfigData } from './configdata';
|
||||||
|
|
||||||
|
@ -18,7 +17,7 @@ var Buffer = require('buffer/').Buffer;
|
||||||
|
|
||||||
export class UserService{
|
export class UserService{
|
||||||
beUrl = ConfigData.Be_URL;
|
beUrl = ConfigData.Be_URL;
|
||||||
private dataStore: { user: User, owner: Owner, txs: Tx[], countries: Country[]} = {
|
private dataStore: { user: User, owner: Owner, countries: Country[]} = {
|
||||||
user: {
|
user: {
|
||||||
address: '',
|
address: '',
|
||||||
session: '',
|
session: '',
|
||||||
|
@ -41,7 +40,6 @@ export class UserService{
|
||||||
payconf: false,
|
payconf: false,
|
||||||
crmToken: ''
|
crmToken: ''
|
||||||
},
|
},
|
||||||
txs : [],
|
|
||||||
countries: []
|
countries: []
|
||||||
};
|
};
|
||||||
private uZaddr = '';
|
private uZaddr = '';
|
||||||
|
@ -49,13 +47,11 @@ export class UserService{
|
||||||
private _uZaddrUpdated: BehaviorSubject<string> = new BehaviorSubject(this.uZaddr);
|
private _uZaddrUpdated: BehaviorSubject<string> = new BehaviorSubject(this.uZaddr);
|
||||||
private _userUpdated: BehaviorSubject<User> = new BehaviorSubject(this.dataStore.user);
|
private _userUpdated: BehaviorSubject<User> = new BehaviorSubject(this.dataStore.user);
|
||||||
private _ownerUpdated: BehaviorSubject<Owner> = new BehaviorSubject(this.dataStore.owner);
|
private _ownerUpdated: BehaviorSubject<Owner> = new BehaviorSubject(this.dataStore.owner);
|
||||||
private _txsUpdated: BehaviorSubject<Tx[]> = new BehaviorSubject(this.dataStore.txs);
|
|
||||||
private _paidUpdated: BehaviorSubject<boolean> = new BehaviorSubject(this.dataStore.owner.paid);
|
private _paidUpdated: BehaviorSubject<boolean> = new BehaviorSubject(this.dataStore.owner.paid);
|
||||||
private _countriesUpdated: BehaviorSubject<Country[]> = new BehaviorSubject(this.dataStore.countries);
|
private _countriesUpdated: BehaviorSubject<Country[]> = new BehaviorSubject(this.dataStore.countries);
|
||||||
public readonly uZaddrUpdate: Observable<string> = this._uZaddrUpdated.asObservable();
|
public readonly uZaddrUpdate: Observable<string> = this._uZaddrUpdated.asObservable();
|
||||||
public readonly ownerUpdate: Observable<Owner> = this._ownerUpdated.asObservable();
|
public readonly ownerUpdate: Observable<Owner> = this._ownerUpdated.asObservable();
|
||||||
public readonly userUpdate: Observable<User> = this._userUpdated.asObservable();
|
public readonly userUpdate: Observable<User> = this._userUpdated.asObservable();
|
||||||
public readonly txUpdate: Observable<Tx[]> = this._txsUpdated.asObservable();
|
|
||||||
public readonly paidUpdate: Observable<boolean> = this._paidUpdated.asObservable();
|
public readonly paidUpdate: Observable<boolean> = this._paidUpdated.asObservable();
|
||||||
public readonly countriesUpdate: Observable<Country[]> = this._countriesUpdated.asObservable();
|
public readonly countriesUpdate: Observable<Country[]> = this._countriesUpdated.asObservable();
|
||||||
private reqHeaders: HttpHeaders;
|
private reqHeaders: HttpHeaders;
|
||||||
|
@ -68,9 +64,9 @@ export class UserService{
|
||||||
//console.log('US:', this.reqHeaders);
|
//console.log('US:', this.reqHeaders);
|
||||||
this.session = localStorage.getItem('s4z_token');
|
this.session = localStorage.getItem('s4z_token');
|
||||||
this.reqParams = new HttpParams().append('session', this.session!);
|
this.reqParams = new HttpParams().append('session', this.session!);
|
||||||
if (this.session != null) {
|
//if (this.session != null) {
|
||||||
this.findUser();
|
//this.findUser();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
getCountries() {
|
getCountries() {
|
||||||
|
@ -84,6 +80,17 @@ export class UserService{
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkUser() {
|
||||||
|
if (this.session != null) {
|
||||||
|
console.log('calling checkUser');
|
||||||
|
let obs = this.http.get<{validated: boolean}>(this.beUrl + 'checkuser', {headers: this.reqHeaders, params: this.reqParams, observe: 'response'});
|
||||||
|
|
||||||
|
return obs;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
findUser() {
|
findUser() {
|
||||||
if (this.session != null) {
|
if (this.session != null) {
|
||||||
let obs = this.http.get<{message: string, user: any}>(this.beUrl+'api/user', { headers: this.reqHeaders, params: this.reqParams, observe: 'response'});
|
let obs = this.http.get<{message: string, user: any}>(this.beUrl+'api/user', { headers: this.reqHeaders, params: this.reqParams, observe: 'response'});
|
||||||
|
@ -95,7 +102,7 @@ export class UserService{
|
||||||
//console.log(`US: Found user, returning it`);
|
//console.log(`US: Found user, returning it`);
|
||||||
this._uZaddrUpdated.next(Object.assign({},this.dataStore).user.address);
|
this._uZaddrUpdated.next(Object.assign({},this.dataStore).user.address);
|
||||||
this._userUpdated.next(Object.assign({}, this.dataStore).user);
|
this._userUpdated.next(Object.assign({}, this.dataStore).user);
|
||||||
this.getOwner(Object.assign({},this.dataStore.user).address);
|
this.getOwner();
|
||||||
} else {
|
} else {
|
||||||
this.dataStore.user = {
|
this.dataStore.user = {
|
||||||
address: '',
|
address: '',
|
||||||
|
@ -140,7 +147,7 @@ export class UserService{
|
||||||
obs.subscribe({
|
obs.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
//console.log("Entra a console log");
|
//console.log("Entra a console log");
|
||||||
this.getOwner(this.dataStore.user.address);
|
this.getOwner();
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
//console.log("Status is : [" + error.status + "]");
|
//console.log("Status is : [" + error.status + "]");
|
||||||
|
@ -153,10 +160,10 @@ export class UserService{
|
||||||
return obs;
|
return obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
getOwner(address: string) {
|
getOwner() {
|
||||||
//console.log('getOwner', address);
|
//console.log('getOwner', address);
|
||||||
const ownParams = this.reqParams.append('address', address)
|
//const ownParams = this.reqParams.append('address', address)
|
||||||
let obs = this.http.get<{message:string, owner: any}>(this.beUrl+'api/owner', { headers: this.reqHeaders, params: ownParams, observe: 'response'});
|
let obs = this.http.get<{message:string, owner: any}>(this.beUrl+'api/owner', { headers: this.reqHeaders, params: this.reqParams, observe: 'response'});
|
||||||
|
|
||||||
obs.subscribe((OwnerDataResponse) => {
|
obs.subscribe((OwnerDataResponse) => {
|
||||||
//console.log('api/getowner', OwnerDataResponse.status);
|
//console.log('api/getowner', OwnerDataResponse.status);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"outDir": "./dist/out-tsc",
|
"outDir": "./dist/out-tsc",
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": false,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
|
|
Loading…
Reference in a new issue