HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/buyercall/assets/vue/service/leadsContactsService.js
import BuyerGatewayMock from '../gateway/mockGateway';
import BuyerGateway from '../gateway/gateway';

export default {
  createLead: postData => BuyerGateway.post(`/contacts/add`, postData),
  getLeadsById:id => BuyerGateway.get(`/contacts/details/${id}/`),
  updateLead: (id,data) => BuyerGateway.post(`/contacts/edit/${id}/`, data),
  uploadcsv:data => BuyerGateway.post(`/contacts/bulk`, data),
  addCampaign:data => BuyerGateway.post(`/contacts/campaigns`, data),
  getCreditById:id => BuyerGateway.get(`/contacts/credit/${id}/`),


  getLeads: (value) => {
    // Serialize the parameters in the required format
    const serializedParams = Object.entries(value)
      .map(([key, val]) => {
        if (val instanceof Array) {
          return val
            .map((v, i) => Object.entries(v).map(([k, v]) => `${key}[${i}][${k}]=${v}`).join('&'))
            .join('&');
        }
        return `${key}=${val}`;
      })
      .join('&').trim();

    return BuyerGateway.get(`/contacts/list?${serializedParams}`);
  },
  getFilters: () => BuyerGateway.get(`/contacts/filters`),

}