import {mande} from "mande"; const product = mande('/api/v1/products') const queryRemoveZero = (query)=>{ let q = {} Object.keys(query).forEach(key => { query[key] === 'undefined' || query[key] === null || query[key] === '' || (q[key] = query[key]) }) return q } export const ListProducts = (query) => { const q = queryRemoveZero(query) return product.get({query:q}) } export const UpdateProduct=(p)=>{ return product.post(p) } export const GetProduct = (pid) => { return product.get(`p/${encodeURIComponent(pid)}`) }