...
|
...
|
@@ -7,6 +7,10 @@ |
|
|
const api = global.yoho.API;
|
|
|
const favApi = global.yoho.FavAPI;
|
|
|
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const favoriteApi = require('./favorite-api');
|
|
|
|
|
|
const isFavoriteAsync = (uid, pid) => {
|
|
|
let onNewApi = false;
|
|
|
|
...
|
...
|
@@ -27,23 +31,8 @@ const isFavoriteAsync = (uid, pid) => { |
|
|
}
|
|
|
};
|
|
|
|
|
|
const createAsync = (uid, pid) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.favorite.add',
|
|
|
id: pid,
|
|
|
uid: uid,
|
|
|
type: 'product'
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const deleteAsync = (uid, pid) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.favorite.cancel',
|
|
|
fav_id: pid,
|
|
|
uid: uid,
|
|
|
type: 'product'
|
|
|
});
|
|
|
};
|
|
|
const createAsync = _.partial(favoriteApi.addFavAsync, _, _, 'product');
|
|
|
const deleteAsync = _.partial(favoriteApi.cancelFavAsync, _, _, 'product');
|
|
|
|
|
|
module.exports = {
|
|
|
isFavoriteAsync,
|
...
|
...
|
|