|
@@ -26,11 +26,13 @@ export default { |
|
@@ -26,11 +26,13 @@ export default { |
26
|
const result = await this.$api.get('/api/ufo/product/top', {product_id: productId});
|
26
|
const result = await this.$api.get('/api/ufo/product/top', {product_id: productId});
|
27
|
|
27
|
|
28
|
if (result.code === 200) {
|
28
|
if (result.code === 200) {
|
29
|
- commit(Types.UPDATE_PRODUCT_TOP3, {productId, topList: result.data.product_list.slice(0, 3)});
|
29
|
+ const productList = result.data.product_list || [];
|
|
|
30
|
+
|
|
|
31
|
+ commit(Types.UPDATE_PRODUCT_TOP3, {productId, topList: productList.slice(0, 3)});
|
30
|
}
|
32
|
}
|
31
|
},
|
33
|
},
|
32
|
async toggleFav({commit}, {productId, isFav}) {
|
34
|
async toggleFav({commit}, {productId, isFav}) {
|
33
|
- const result = await this.$api.get(`/api/ufo/product/${isFav ? 'add' : 'cancel'}`, {productId});
|
35
|
+ const result = await this.$api.get(`/api/ufo/product/favorite/${isFav ? 'add' : 'cancel'}`, {productId});
|
34
|
|
36
|
|
35
|
if (result && result.code === 200) {
|
37
|
if (result && result.code === 200) {
|
36
|
commit(Types.UPDATE_PRODUCT_FAV, {productId, isFav});
|
38
|
commit(Types.UPDATE_PRODUCT_FAV, {productId, isFav});
|