Skip to main content
Long Tran
💬
0 discussions

Code Snippets

I. Introduction

This document includes code snippets for application.

II. Features

1. Register Warranty

  const {
account: {
crm: { authType, host, ...rest },
},
name,
} = company;
const CRMProvider = require(`../3rd/CRM/${name}`).default;
const auth = {};
const authObj = rest[`${authType}Auth`];
Object.keys(authObj).forEach((key) => {
if (key.includes('pass') || key.includes('token') || key.includes('value')) {
auth[key] = decryptPassword(authObj[key]);
} else {
auth[key] = authObj[key];
}
});

const CRM = new CRMProvider(auth, host);
return CRM;

Description: This code snippet is used to get the CRM provider based on the company name.