Appearance
useProductReviews
Definition
Composable for listing customer orders.
Basic usage
ts
const {
productReviews,
addReview,
loadProductReviews
} = useProductReviews(product);
Signature
ts
export function useProductReviews(
product: Ref<Product>
): UseProductReviewsReturn
Parameters
Name | Type | Description |
---|---|---|
product | Ref<Product> |
Return type
See UseProductReviewsReturn
ts
export type UseProductReviewsReturn = {
/**
* All reviews added to the product
*/
productReviews: ComputedRef<ProductReview[]>;
/**
* Adds a review to the product
* @param data `title` - review title, `content` - review content, `points` - review points (range of 1-5)
* @returns
*/
addReview(data: {
title: string;
content: string;
points: number;
}): Promise<void>;
/**
* Fetches the reviews list and assigns the result to the `productReviews` property
* @param parameters {@link ShopwareSearchParams}
* @returns
*/
loadProductReviews(parameters?: ShopwareSearchParams): Promise<void>;
};
Properties
Name | Type | Description |
---|---|---|
productReviews | ComputedRef<Array<ProductReview>> | All reviews added to the product |
Methods
Name | Type | Description |
---|---|---|
addReview | Promise<void> | Adds a review to the product |
loadProductReviews | Promise<void> | Fetches the reviews list and assigns the result to the `productReviews` property |