I want to have a return boolean value based on conditions when I call my API that return an object, but I can't figure out how to do it because I get every time a subscription...
This is my code on component.ts:
result(){
return checkPiva()
}
checkPiva(){
return this._mysrvUsers.getUserByPIVA('858585847');
}
and this is my code on service.ts:
getUserByPIVA(piva: string){
const currentResellerCode = localStorage.getItem('resellercode')
const url = env.apiUrl + "endUser/partitaIva?pi="+piva
return this.httpClient.get(url).pipe(map(res=>{
if(res){
return true;
}else{
return false
}
}))
}
booleanvalue insteadObservable<boolean>?.toPromise()and then use async/await, or otherwise use callbacks.