Good afternoon.
I have a problem with the arrangement that the only thing it has is a user id, the fix is filled from BD, and it brings me the data and shows them, but at the time that in the promise I want to assign that value to a variable it tells me [object object] and I do not know how to do it.
What I’m trying to do is to assign the value that comes within the array to a variable, I tried to add it directly from the id_costumer but it says [object object] or indefinite
my services
public function idUsuarioRegistrado_get ( $token = 0 ) {
//Petición a BD
$queryidUser = $this->db->query('SELECT c.id_customer from ps_customer c where c.token = "'.$token.'" group by c.id_customer limit 1');
//Manejo de errores
$respuesta = array(
'error' => FALSE,
'idUsuarioObtenido' => $queryidUser->result_array()
);
$this->response ( $respuesta );
}
my code
idUsuarioRegistrado( token:string ){
let promesa = new Promise ( (resolve, reject)=>{
let url = URL_SERVICIOS + “registro/idUsuarioRegistrado/” + token; //Obtengo el url
//Peticion del servicio
this.http.get( url ).subscribe ( res => {
//console.log(res);
if ( res['error'] ) {
//Aquí tenemos un error
}
else{
this.idUsuarioObtenido = res['idUsuarioObtenido'];
this.id_usuario = this.idUsuarioObtenido[0]; //Grabo el usuario
console.log( this.id_usuario );
this.logProv.guadarStorage();
}
})
resolve();
})
return promesa;
}
Thanks in advance
I hope you can help me since the truth is I’m relatively new in this
regards