import { map } from 'lodash' ; import api from 'teleport/services/api' ; import cfg from 'teleport/config' ; import makeDesktop from './makeDesktop' ; class DesktopService { fetchDesktops ( clusterId ) { return api . get ( cfg . getDesktopsUrl ( clusterId ) ) . then ( json => map ( json , makeDesktop ) ) ; } fetchDesktop ( clusterId , desktopPath ) { return api . get ( cfg . getDesktopUrl ( clusterId , desktopPath ) ) . then ( json => makeDesktop ( json ) ) ; } } export default DesktopService ;