У меня проблемы с данными, полученными с сервера. Мне нужно проверить, доступно ли имя пользователя, и затем выполнить http.get, это не проблема, мне нужно вернуть содержимое http.get как наблюдаемое, чтобы создать объект позже.
registerUser(user: RegisterComponent): Observable<any> {
let headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded');
let exists = this.http.get(this.url + "verifyCuentaUsuarioApp.php?cuenta=" + user.cuentaUser + "&id=" + user.passUser);
exists.subscribe(response => {
if (response != null) {
//console.log("this is the message "+response.mensaje);
if (response.data[0].estatus == "0") {
console.log("disponible");
//I need the content of this request to be returned
this.http.get(this.url + 'registroClienteApp.php?' + params, { headers: headers });
} else
console.log("no disponible");
}
});
return this.http.get(this.url + 'registroClienteApp.php?' + params, { headers: headers });
}