Skip to content

Commit

Permalink
fix: code smell for nested template literals
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauravudia committed Nov 16, 2023
1 parent 30c192f commit 26fbdb4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/v0/destinations/mp/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ const mPEventPropertiesConfigJson = mappingConfig[ConfigCategory.EVENT_PROPERTIE
const setImportCredentials = (destConfig) => {
const endpoint =
destConfig.dataResidency === 'eu' ? `${BASE_ENDPOINT_EU}/import/` : `${BASE_ENDPOINT}/import/`;
const headers = { 'Content-Type': 'application/json' };
const params = { strict: destConfig.strictMode ? 1 : 0 };
const { serviceAccountUserName, serviceAccountSecret, projectId, token } = destConfig;
let credentials;
if (serviceAccountUserName && serviceAccountSecret && projectId) {
headers.Authorization = `Basic ${base64Convertor(
`${serviceAccountUserName}:${serviceAccountSecret}`,
)}`;
credentials = `${serviceAccountUserName}:${serviceAccountSecret}`;
params.projectId = projectId;
} else {
headers.Authorization = `Basic ${base64Convertor(`${token}:`)}`;
credentials = `${token}:`;
}
const headers = {
'Content-Type': 'application/json',
Authorization: `Basic ${base64Convertor(credentials)}`,
};
return { endpoint, headers, params };
};

Expand Down

0 comments on commit 26fbdb4

Please sign in to comment.