--- /dev/null
+(function() {
+ "use strict";
+
+ angular
+ .module("nero.app.external-services")
+ .factory("connectorService", connectorService);
+
+ connectorService.$inject = ["$http", "$q", "$filter"];
+
+ /*
+ Attachment service implementation
+ */
+ function connectorService($http, $q, $filter) {
+
+ return {
+ loadConnectorConfig: loadConnectorConfig
+ };
+
+ // Add a list of files to a session
+ function loadConnectorConfig() {
+
+ var config = {};
+ config.params = {
+ cmd: "loadConnectorConfig"
+ };
+
+ return $http.get(actionURLAjax, config)
+ .then(loadConnectorConfigComplete)
+ ["catch"](loadConnectorConfigFailed);
+
+ function loadConnectorConfigComplete(response) {
+ if (response.data.success) {
+ return response.data;
+ }
+
+ // If success variable is false or undefined then throw an error
+ var message = $filter("translate")("ext.nero.services.connector.toastr-load-config-errorMessage");
+ return ($q.reject(message));
+ }
+
+ function loadConnectorConfigFailed(error) {
+ // If message is undefined then throw unknown error. Otherwise, use expected error message.
+ if (!angular.isObject(error.data) || !error.data.message) {
+ var message = $filter("translate")("ext.nero.services.connector.toastr-load-config-errorMessage");
+ return ($q.reject(message));
+ }
+
+ return ($q.reject(error.data.message));
+ }
+ }
+
+ }
+})();