import { CUSTOMER_API } from '../../utils/ResourceConstants' import { createAjaxRoute, lessThanThreeErrors } from '../utils/apiHelpers' import { IProfile, } from './interfaces' export const fetchEnrichment = (emails: string[], accessToken: string) => { return createAjaxRoute({ url: `${CUSTOMER_API}/enrichment/request`, method: 'POST', token: accessToken, body: JSON.stringify({ emails }), }) .retryWhen(lessThanThreeErrors) .map((data: any): IProfile[] => data.response.profiles) }