@nodeart/firebase-connector
Advanced tools
Comparing version 2.1.18 to 2.1.19
@@ -36,3 +36,3 @@ { | ||
}, | ||
"version": "2.1.18" | ||
"version": "2.1.19" | ||
} |
@@ -209,18 +209,2 @@ import { Http, Response } from '@angular/http'; | ||
/** | ||
* Returns product by queryObj provided by DbAbstractionLayer | ||
* | ||
* @param {Object} queryObj ElasticSearch query object | ||
* | ||
* @returns {Observable} Observable of product object | ||
*/ | ||
getOneProduct(queryObj){ | ||
let key = firebase.database().ref().child('search/request').push(queryObj).key; | ||
return Observable.create( observer => { | ||
firebase.database().ref().child('search/response/' + key + '/hits').on('value', data => { | ||
observer.next(data); | ||
}); | ||
}); | ||
} | ||
/** | ||
* Returns basket content of specific user | ||
@@ -329,8 +313,11 @@ * | ||
type: type, | ||
query: JSON.stringify(queryObj) | ||
body: queryObj | ||
}).key; | ||
console.log(key); | ||
return Observable.create( observer => { | ||
firebase.database().ref().child('search/response/' + key + '/hits').on('value', data => { | ||
observer.next(data); | ||
firebase.database().ref().child('search/response/' + key + '/hits/hits').on('value', data => { | ||
if(data.val()){ | ||
console.log(data.val()); | ||
observer.next(data); | ||
} | ||
}); | ||
@@ -353,6 +340,6 @@ }); | ||
type: type, | ||
query: JSON.stringify(queryObj) | ||
body: queryObj | ||
}).key; | ||
return Observable.create( observer => { | ||
firebase.database().ref().child('search/response/' + key).on('value', data => { | ||
firebase.database().ref().child('search/response/' + key + '/hits').on('value', data => { | ||
observer.next(data); | ||
@@ -376,6 +363,6 @@ }); | ||
type: type, | ||
query: JSON.stringify(queryObj) | ||
body: queryObj | ||
}).key; | ||
return Observable.create( observer => { | ||
firebase.database().ref().child('search/response/' + key + '/total').on('value', data => { | ||
firebase.database().ref().child('search/response/' + key + '/hits/total').on('value', data => { | ||
observer.next(data); | ||
@@ -382,0 +369,0 @@ }); |
30799
750