Note: Not complete yet..
The woocommerce API npm is promise-based. To convert promise to observable I did
getProducts(page: number): Observable<any> {
return new Observable((observer) => {
this.wooCommerce.getAsync('products').then((data) => {
observer.next(JSON.parse(data.body));
observer.complete();
}).catch((error) => {
console.error(error);
observer.error();
});
});
}
How to convert promise to observable in rxjs