5 .module("nero.app.external-services")
6 .factory("connectorService", connectorService);
8 connectorService.$inject = ["$http", "$q", "$filter"];
11 Attachment service implementation
13 function connectorService($http, $q, $filter) {
16 loadConnectorConfig: loadConnectorConfig
19 // Add a list of files to a session
20 function loadConnectorConfig() {
24 cmd: "loadConnectorConfig"
27 return $http.get(actionURLAjax, config)
28 .then(loadConnectorConfigComplete)
29 ["catch"](loadConnectorConfigFailed);
31 function loadConnectorConfigComplete(response) {
32 if (response.data.success) {
36 // If success variable is false or undefined then throw an error
37 var message = $filter("translate")("ext.nero.services.connector.toastr-load-config-errorMessage");
38 return ($q.reject(message));
41 function loadConnectorConfigFailed(error) {
42 // If message is undefined then throw unknown error. Otherwise, use expected error message.
43 if (!angular.isObject(error.data) || !error.data.message) {
44 var message = $filter("translate")("ext.nero.services.connector.toastr-load-config-errorMessage");
45 return ($q.reject(message));
48 return ($q.reject(error.data.message));