59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
/**
|
|
* Mini program API wrapper for this module.
|
|
* Call guide: require this module in a page, then invoke the matching method from page event handlers or lifecycle hooks.
|
|
*/
|
|
const request = require('../utils/request')
|
|
|
|
module.exports = {
|
|
/**
|
|
* Purpose: addToWishlist supports wishlist.js by holding or executing the add to wishlist page or API role.
|
|
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
|
|
*/
|
|
addToWishlist(productId) {
|
|
return request({
|
|
url: '/wishlist/add',
|
|
method: 'POST',
|
|
data: {
|
|
productId
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: removeFromWishlist supports wishlist.js by holding or executing the remove from wishlist page or API role.
|
|
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
|
|
*/
|
|
removeFromWishlist(productId) {
|
|
return request({
|
|
url: '/wishlist/remove',
|
|
method: 'POST',
|
|
data: {
|
|
productId
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: checkWishlist supports wishlist.js by holding or executing the check wishlist page or API role.
|
|
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
|
|
*/
|
|
checkWishlist(productId) {
|
|
return request({
|
|
url: '/wishlist/check',
|
|
params: {
|
|
productId
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* Purpose: getWishlist supports wishlist.js by holding or executing the get wishlist page or API role.
|
|
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
|
|
*/
|
|
getWishlist() {
|
|
return request({
|
|
url: '/wishlist/list'
|
|
})
|
|
}
|
|
}
|