Order
This endpoint is used for the purpose of rating an order. It fetches the order's id, which will be rated.
:::tip
The order rating endpoint has been implemented in the Rating Web Component, , and It's all setup to save developer's time and effort.
:::
Payload authenticated
Response
Usage
To perform the action of rating an order, the method order()
may be called as below, with the id of the order to be rated.
salla.rating.order({ order_id: 978 }).then((response) => {
/* add your code here */
});
// TIP: short version
salla.rating.order(978).then((response) => {
/* add your code here */
});
Events
This endpoint may trigger two events, the onOrderFetched and onOrderNotFetched events.
onOrderFetched
This event is triggered when fetching the id of the order to be rated is done without having any errors coming back from the backend.
salla.event.rating.onOrderFetched((response) => {
console.log(response)
});
onOrderNotFetched
This event is triggered when fetching the id of the order to be rated is not completed and an error has occurred.
```js
salla.event.rating.onOrderNotFetched((errorMessage) => {
console.log(errorMessage)
});