import { createAjaxRoute, lessThanThreeErrors } from '../utils/apiHelpers' import { CUSTOMER_API } from '../../utils/ResourceConstants' import { IOrg, IOrgProperties } from './interfaces' export const fetchOrg = (orgId: number, accessToken: string) => { return createAjaxRoute({ url: `${CUSTOMER_API}/organizations/${orgId}`, method: 'GET', token: accessToken, }) .retryWhen(lessThanThreeErrors) .map((data: any): IOrg => data.response) } export const fetchOrgProperties = (orgId: number, accessToken: string) => { return createAjaxRoute({ url: `${CUSTOMER_API}/organizations/${orgId}/properties`, method: 'GET', token: accessToken, }) .retryWhen(lessThanThreeErrors) .map((data: any): IOrgProperties => data.response) } export const fetchUsers = (orgId: string, accessToken: string) => { return createAjaxRoute({ url: `${CUSTOMER_API}/organizations/${orgId}/users`, method: 'GET', token: accessToken, }) .retryWhen(lessThanThreeErrors) .map((data: any) => data.response) }