feat(pipedrive): add create lead action
This commit is contained in:
@@ -2,6 +2,7 @@ import listActivityTypes from './list-activity-types';
|
||||
import listCurrencies from './list-currencies';
|
||||
import listDeals from './list-deals';
|
||||
import listLeads from './list-leads';
|
||||
import listLeadLabels from './list-lead-labels';
|
||||
import listOrganizations from './list-organizations';
|
||||
import listPersons from './list-persons';
|
||||
import listUsers from './list-users';
|
||||
@@ -11,6 +12,7 @@ export default [
|
||||
listCurrencies,
|
||||
listDeals,
|
||||
listLeads,
|
||||
listLeadLabels,
|
||||
listOrganizations,
|
||||
listPersons,
|
||||
listUsers,
|
||||
|
@@ -0,0 +1,34 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List lead labels',
|
||||
key: 'listLeadLabels',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const leadLabels: {
|
||||
data: IJSONObject[];
|
||||
} = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
const { data } = await $.http.get(
|
||||
`${$.auth.data.apiDomain}/api/v1/leadLabels`
|
||||
);
|
||||
|
||||
if (!data?.data) {
|
||||
return { data: [] };
|
||||
}
|
||||
|
||||
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;
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user