selectOrders$(): Promise<Observable<UserOrder[]>>¶
The selectOrders$
method allows you to get the information about the orders of a currently authenticated user.
Returned value¶
A returned value has a type of Promise<Observable<UserOrder[]>>
where UserOrder
represents the UserOrder model.
Example¶
In this example we make a UserApi
call to get all current digital orders of an authenticated user.
useStorefront(async (storefront) => {
const userApi = await storefront.getApi('UserApi');
const userOrders$ = await userApi.selectOrders$();
userOrders$.subscribe((userOrders) => {
const digitalOrders = userOrders.filter((order) => order.isDigital);
console.log('ids of the digital orders:', digitalOrders.reduce((orderIds, currOrder) => `${orderIds} ${currOrder.id}`));
});
});
User API methods reference¶
- getUser
- selectUser$
- getOrders
- getAddresses
- selectAddresses$
- isProductNotificationPossible
- selectIsProductNotificationPossible$
- getLoyaltyPoints
- selectLoyaltyPoints$