Files
redash/client/app/services/destination.js
Levko Kravets b0b4d5e26a Convert Angular services to CommonJS-style and use them in React components instead of injecting (#3331)
* Refine Auth service: remove dead code and fix race condition
* Export services in CommonJS style
* Refine Users, Events and OfflineListener services
* Refactor Notifications service - rewrite to CommonJS
* Replace Angular service injection with imports in React components
* Fix Footer tests
* Events service -> recordEvent function
* CR1
2019-01-24 16:24:58 +02:00

20 lines
539 B
JavaScript

export let Destination = null; // eslint-disable-line import/no-mutable-exports
function DestinationService($resource) {
const actions = {
get: { method: 'GET', cache: false, isArray: false },
query: { method: 'GET', cache: false, isArray: true },
};
return $resource('api/destinations/:id', { id: '@id' }, actions);
}
export default function init(ngModule) {
ngModule.factory('Destination', DestinationService);
ngModule.run(($injector) => {
Destination = $injector.get('Destination');
});
}
init.init = true;