import { map , sortBy } from 'lodash' ; import api from 'teleport/services/api' ; import cfg from 'teleport/config' ; import makeCluster from './makeCluster' ; const service = { fetchClusters ( ) { return api . get ( cfg . api . clustersPath ) . then ( json => map ( json , makeCluster ) ) . then ( clusters => sortBy ( clusters , 'clusterId' ) ) ; } , } ; export default service ;