Hello, i run a function which stores a value from a JSON object into a variable called token.The issue is that everytime that i refresh my chrome and run my app i got the error
Typescript Error Property ‘Model’ does not exist on type ‘HttpClient’.
import { HttpClient,HttpEvent } from '@angular/common/http';
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';
import {Observable} from "rxjs/Observable";
import {Storage} from "@ionic/storage";
var webApihost="http://192.168.0.6:81/EBSWebApi/";
var scrollerid="ES00BACKUP/KHCApp_Items";
var scrid = "ES00BACKUP/KHCApp_Contacts";
@Injectable()
export class LoginserviceProvider {
public token:string;
public Mobile1:string;
params: {
SubscriptionPassword: string;
model: {
BranchID: string;
LangID: string;
UserID: string;
Password: string;
}
};
//scroller code below//
paramsScroller: {
headers: {
Authorization: string;
},
data: {
Code: string;
}
};
//storage-scrid code below//
paramsScrid:{
Mobile1:string;
Code:string;
};
url = webApihost + 'api/login';
//scroller code below//
url2 = webApihost + "api/rpc/SimpleScrollerRootTable/" + scrollerid;
//scrid code below
url3 = webApihost + "api/rpc/SimpleScrollerRootTable/" + scrid;
constructor(public http: HttpClient,
private storage:Storage) {
console.log('Hello LoginserviceProvider Provider');
this.url =webApihost + 'api/login';
this.url2 =webApihost + "api/rpc/SimpleScrollerRootTable/" + scrollerid;
this.url3 =webApihost + "api/rpc/SimpleScrollerRootTable/" + scrid;
}
getWebApi(url, params): Observable<HttpClient> {
return this.http.post<HttpClient>
(this.url, params);
}
getScrollerID(url, paramsScroller): Observable<HttpEvent<HttpClient>> {
return this.http.get<HttpClient>
(this.url2, paramsScroller);
}
getScrid(url, paramsScroller): Observable<HttpEvent<HttpClient>> {
return this.http.get<HttpClient>
(this.url3, paramsScroller);
}
authenticationWebApi() {
this.url = webApihost + 'api/login';
this.params = {
SubscriptionPassword: 'passx',
model: {
BranchID: "01",
LangID: "el-GR",
UserID: "khcadmin",
Password: "P@ssw0rd",
}
};
//this.token = "";
console.log("Token Before = " + this.token);
return this.getWebApi(this.url, this.params)
.subscribe(data => {
console.log(data);
this.token = data.Model.WebApiToken;
//this.storage.set('token',this.token);
// console.log("Μόλις πήρα το Token -> " + this.token);
// this.scrollerID();
// this.scrid();
});
};