Skip to content

Commit f7523f7

Browse files
committed
Added custom resource action
1 parent f116b68 commit f7523f7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/ViewProduct.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,15 @@
7171
};
7272
},
7373
created() {
74+
let customActions = {
75+
softDelete: {
76+
method: 'DELETE',
77+
url: 'http://localhost:3000/products/{productId}/reviews/{reviewId}?soft=true'
78+
}
79+
};
80+
7481
let url = 'http://localhost:3000/products/{productId}/reviews/{reviewId}';
75-
this.reviewResource = this.$resource(url);
82+
this.reviewResource = this.$resource(url, {}, customActions);
7683
7784
this.getProduct(this.productId)
7885
.then(product => this.product = product);
@@ -108,7 +115,8 @@
108115
).then(newReview => this.product.reviews.push(newReview));
109116
},
110117
deleteReview(review) {
111-
this.reviewResource.delete({
118+
//this.reviewResource.delete({
119+
this.reviewResource.softDelete({
112120
productId: this.product.id,
113121
reviewId: review.id
114122
}).then(

0 commit comments

Comments
 (0)