favorite-product-api.js 730 Bytes
/**
 * Created by TaoHuang on 2016/6/13.
 */

'use strict';

const api = global.yoho.API;
const favApi = global.yoho.FavAPI;

const isFavoriteAsync = (uid, pid) => {
    return favApi.get('', {
        method: 'app.favorite.isFavoriteNew',
        id: pid,
        uid: uid,
        type: 'product'
    });
};

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'
    });
};

module.exports = {
    isFavoriteAsync,
    createAsync,
    deleteAsync
};