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