File size: 506 Bytes
3206347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
export default {
  name: 'List lead labels',
  key: 'listLeadLabels',

  async run($) {
    const leadLabels = {
      data: [],
    };

    const { data } = await $.http.get(
      `${$.auth.data.apiDomain}/api/v1/leadLabels`
    );

    if (data.data?.length) {
      for (const leadLabel of data.data) {
        const name = `${leadLabel.name} (${leadLabel.color})`;
        leadLabels.data.push({
          value: leadLabel.id,
          name,
        });
      }
    }

    return leadLabels;
  },
};