I found an API library for Woocommerce and trying to integrate it in Angular.
for fetching categories it looks like this line is needed.
const json = await WooWorker.getCategories();
My service looks like this:
import { WooWorker } from "api-ecommerce";
GetAllUsers(): Observable<any> {
return this.http.get(`${BASEURL}/categories`);
}
I need to replace this part return this.http.get(
${BASEURL}/categories);
with this const json = await WooWorker.getCategories();
since API uses the second way. How will be correct to do it with observable?
2
Answers
Try this way as given above by returning the data from it
You can write it in this way.
of
is an RxJS operator that converts the input into an observable.