2016-12-01 11:40:28 +02:00
|
|
|
/*
|
2019-02-01 16:39:33 +02:00
|
|
|
* Copyright © 2016-2019 The Thingsboard Authors
|
2016-12-01 11:40:28 +02:00
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
import thingsboardTypes from '../common/types.constant';
|
|
|
|
|
|
|
|
|
|
export default angular.module('thingsboard.api.device', [thingsboardTypes])
|
|
|
|
|
.factory('deviceService', DeviceService)
|
|
|
|
|
.name;
|
|
|
|
|
|
|
|
|
|
/*@ngInject*/
|
2019-05-22 12:44:05 +03:00
|
|
|
function DeviceService($http, $q, $window, userService, attributeService, customerService, types) {
|
2016-12-01 11:40:28 +02:00
|
|
|
|
|
|
|
|
var service = {
|
|
|
|
|
assignDeviceToCustomer: assignDeviceToCustomer,
|
|
|
|
|
deleteDevice: deleteDevice,
|
|
|
|
|
getCustomerDevices: getCustomerDevices,
|
|
|
|
|
getDevice: getDevice,
|
2017-03-07 12:26:42 +02:00
|
|
|
getDevices: getDevices,
|
2016-12-01 11:40:28 +02:00
|
|
|
getDeviceCredentials: getDeviceCredentials,
|
|
|
|
|
getTenantDevices: getTenantDevices,
|
|
|
|
|
saveDevice: saveDevice,
|
2019-05-20 11:57:43 +03:00
|
|
|
saveDeviceParameters: saveDeviceParameters,
|
2016-12-01 11:40:28 +02:00
|
|
|
saveDeviceCredentials: saveDeviceCredentials,
|
|
|
|
|
unassignDeviceFromCustomer: unassignDeviceFromCustomer,
|
2017-04-23 18:04:55 +03:00
|
|
|
makeDevicePublic: makeDevicePublic,
|
2016-12-01 11:40:28 +02:00
|
|
|
getDeviceAttributes: getDeviceAttributes,
|
|
|
|
|
subscribeForDeviceAttributes: subscribeForDeviceAttributes,
|
|
|
|
|
unsubscribeForDeviceAttributes: unsubscribeForDeviceAttributes,
|
|
|
|
|
saveDeviceAttributes: saveDeviceAttributes,
|
|
|
|
|
deleteDeviceAttributes: deleteDeviceAttributes,
|
|
|
|
|
sendOneWayRpcCommand: sendOneWayRpcCommand,
|
2017-05-24 10:39:33 +03:00
|
|
|
sendTwoWayRpcCommand: sendTwoWayRpcCommand,
|
2017-05-28 18:23:05 +03:00
|
|
|
findByQuery: findByQuery,
|
2019-05-20 11:57:43 +03:00
|
|
|
getDeviceTypes: getDeviceTypes,
|
|
|
|
|
findByName: findByName
|
2016-12-01 11:40:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return service;
|
|
|
|
|
|
2017-05-28 18:23:05 +03:00
|
|
|
function getTenantDevices(pageLink, applyCustomersInfo, config, type) {
|
2016-12-01 11:40:28 +02:00
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/tenant/devices?limit=' + pageLink.limit;
|
|
|
|
|
if (angular.isDefined(pageLink.textSearch)) {
|
|
|
|
|
url += '&textSearch=' + pageLink.textSearch;
|
|
|
|
|
}
|
|
|
|
|
if (angular.isDefined(pageLink.idOffset)) {
|
|
|
|
|
url += '&idOffset=' + pageLink.idOffset;
|
|
|
|
|
}
|
|
|
|
|
if (angular.isDefined(pageLink.textOffset)) {
|
|
|
|
|
url += '&textOffset=' + pageLink.textOffset;
|
|
|
|
|
}
|
2017-05-28 18:23:05 +03:00
|
|
|
if (angular.isDefined(type) && type.length) {
|
|
|
|
|
url += '&type=' + type;
|
|
|
|
|
}
|
2017-04-17 12:21:12 +03:00
|
|
|
$http.get(url, config).then(function success(response) {
|
2017-04-23 18:04:55 +03:00
|
|
|
if (applyCustomersInfo) {
|
|
|
|
|
customerService.applyAssignedCustomersInfo(response.data.data).then(
|
|
|
|
|
function success(data) {
|
|
|
|
|
response.data.data = data;
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
},
|
|
|
|
|
function fail() {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}
|
2016-12-01 11:40:28 +02:00
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-28 18:23:05 +03:00
|
|
|
function getCustomerDevices(customerId, pageLink, applyCustomersInfo, config, type) {
|
2016-12-01 11:40:28 +02:00
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/customer/' + customerId + '/devices?limit=' + pageLink.limit;
|
|
|
|
|
if (angular.isDefined(pageLink.textSearch)) {
|
|
|
|
|
url += '&textSearch=' + pageLink.textSearch;
|
|
|
|
|
}
|
|
|
|
|
if (angular.isDefined(pageLink.idOffset)) {
|
|
|
|
|
url += '&idOffset=' + pageLink.idOffset;
|
|
|
|
|
}
|
|
|
|
|
if (angular.isDefined(pageLink.textOffset)) {
|
|
|
|
|
url += '&textOffset=' + pageLink.textOffset;
|
|
|
|
|
}
|
2017-05-28 18:23:05 +03:00
|
|
|
if (angular.isDefined(type) && type.length) {
|
|
|
|
|
url += '&type=' + type;
|
|
|
|
|
}
|
2017-04-23 18:04:55 +03:00
|
|
|
$http.get(url, config).then(function success(response) {
|
|
|
|
|
if (applyCustomersInfo) {
|
|
|
|
|
customerService.applyAssignedCustomerInfo(response.data.data, customerId).then(
|
|
|
|
|
function success(data) {
|
|
|
|
|
response.data.data = data;
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
},
|
|
|
|
|
function fail() {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}
|
2016-12-01 11:40:28 +02:00
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
});
|
2017-04-23 18:04:55 +03:00
|
|
|
|
2016-12-01 11:40:28 +02:00
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-23 18:04:55 +03:00
|
|
|
function getDevice(deviceId, ignoreErrors, config) {
|
2016-12-01 11:40:28 +02:00
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/device/' + deviceId;
|
2017-04-23 18:04:55 +03:00
|
|
|
if (!config) {
|
|
|
|
|
config = {};
|
|
|
|
|
}
|
2019-05-20 11:57:43 +03:00
|
|
|
config = Object.assign(config, {ignoreErrors: ignoreErrors});
|
2017-04-23 18:04:55 +03:00
|
|
|
$http.get(url, config).then(function success(response) {
|
2016-12-01 11:40:28 +02:00
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}, function fail(response) {
|
|
|
|
|
deferred.reject(response.data);
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-23 18:04:55 +03:00
|
|
|
function getDevices(deviceIds, config) {
|
2017-03-07 12:26:42 +02:00
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var ids = '';
|
2019-05-20 11:57:43 +03:00
|
|
|
for (var i = 0; i < deviceIds.length; i++) {
|
|
|
|
|
if (i > 0) {
|
2017-03-07 12:26:42 +02:00
|
|
|
ids += ',';
|
|
|
|
|
}
|
|
|
|
|
ids += deviceIds[i];
|
|
|
|
|
}
|
|
|
|
|
var url = '/api/devices?deviceIds=' + ids;
|
2017-04-23 18:04:55 +03:00
|
|
|
$http.get(url, config).then(function success(response) {
|
2017-03-07 12:26:42 +02:00
|
|
|
var devices = response.data;
|
|
|
|
|
devices.sort(function (device1, device2) {
|
2019-05-20 11:57:43 +03:00
|
|
|
var id1 = device1.id.id;
|
|
|
|
|
var id2 = device2.id.id;
|
|
|
|
|
var index1 = deviceIds.indexOf(id1);
|
|
|
|
|
var index2 = deviceIds.indexOf(id2);
|
|
|
|
|
return index1 - index2;
|
2017-03-07 12:26:42 +02:00
|
|
|
});
|
|
|
|
|
deferred.resolve(devices);
|
|
|
|
|
}, function fail(response) {
|
|
|
|
|
deferred.reject(response.data);
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 11:57:43 +03:00
|
|
|
function saveDevice(device, config) {
|
|
|
|
|
config = config || {};
|
2016-12-01 11:40:28 +02:00
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/device';
|
2019-05-20 11:57:43 +03:00
|
|
|
$http.post(url, device, config).then(function success(response) {
|
2016-12-01 11:40:28 +02:00
|
|
|
deferred.resolve(response.data);
|
2019-05-21 19:00:52 +03:00
|
|
|
}, function fail(response) {
|
|
|
|
|
deferred.reject(response);
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 11:57:43 +03:00
|
|
|
function saveDeviceRelarion(deviceId, deviceRelation, config) {
|
2019-05-21 19:00:52 +03:00
|
|
|
const deferred = $q.defer();
|
|
|
|
|
let attributesType = Object.keys(types.attributesScope);
|
|
|
|
|
let allPromise = [];
|
|
|
|
|
let promise = "";
|
|
|
|
|
for (let i = 0; i < attributesType.length; i++) {
|
2019-05-20 11:57:43 +03:00
|
|
|
if (deviceRelation.attributes[attributesType[i]] && deviceRelation.attributes[attributesType[i]].length !== 0) {
|
2019-05-22 12:44:05 +03:00
|
|
|
promise = attributeService.saveEntityAttributes(types.entityType.device, deviceId, types.attributesScope[attributesType[i]].value, deviceRelation.attributes[attributesType[i]], config);
|
2019-05-20 11:57:43 +03:00
|
|
|
allPromise.push(promise);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (deviceRelation.timeseries.length !== 0) {
|
2019-05-22 12:44:05 +03:00
|
|
|
promise = attributeService.saveEntityTimeseries(types.entityType.device, deviceId, "time", deviceRelation.timeseries, config);
|
2019-05-20 11:57:43 +03:00
|
|
|
allPromise.push(promise);
|
|
|
|
|
}
|
|
|
|
|
$q.all(allPromise).then(function success() {
|
|
|
|
|
deferred.resolve();
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveDeviceParameters(deviceParameters, update, config) {
|
|
|
|
|
config = config || {};
|
2019-05-21 19:00:52 +03:00
|
|
|
const deferred = $q.defer();
|
|
|
|
|
let statisticalInfo = {
|
|
|
|
|
create: {},
|
|
|
|
|
update: {},
|
|
|
|
|
error: {}
|
|
|
|
|
};
|
|
|
|
|
let newDevice = {
|
2019-05-20 11:57:43 +03:00
|
|
|
name: deviceParameters.name,
|
|
|
|
|
type: deviceParameters.type
|
|
|
|
|
};
|
2019-05-22 12:44:05 +03:00
|
|
|
saveDevice(newDevice, config).then(function success(response) {
|
2019-05-21 19:00:52 +03:00
|
|
|
statisticalInfo.create.device = 1;
|
2019-05-20 11:57:43 +03:00
|
|
|
saveDeviceRelarion(response.id.id, deviceParameters, config).then(function success() {
|
2019-05-21 19:00:52 +03:00
|
|
|
deferred.resolve(statisticalInfo);
|
2019-05-20 11:57:43 +03:00
|
|
|
});
|
2019-05-21 19:00:52 +03:00
|
|
|
}, function fail(response) {
|
|
|
|
|
console.log(response); // eslint-disable-line
|
2019-05-20 11:57:43 +03:00
|
|
|
if (update) {
|
2019-05-22 12:44:05 +03:00
|
|
|
findByName(deviceParameters.name, config).then(function success(response) {
|
2019-05-21 19:00:52 +03:00
|
|
|
statisticalInfo.update.device = 1;
|
2019-05-20 11:57:43 +03:00
|
|
|
saveDeviceRelarion(response.id.id, deviceParameters, config).then(function success() {
|
2019-05-21 19:00:52 +03:00
|
|
|
deferred.resolve(statisticalInfo);
|
2019-05-20 11:57:43 +03:00
|
|
|
});
|
2019-05-21 19:00:52 +03:00
|
|
|
}, function fail() {
|
|
|
|
|
statisticalInfo.error.device = newDevice;
|
|
|
|
|
deferred.resolve(statisticalInfo);
|
2019-05-20 11:57:43 +03:00
|
|
|
});
|
|
|
|
|
} else {
|
2019-05-21 19:00:52 +03:00
|
|
|
statisticalInfo.error.device = newDevice;
|
|
|
|
|
deferred.resolve(statisticalInfo);
|
2019-05-20 11:57:43 +03:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-01 11:40:28 +02:00
|
|
|
function deleteDevice(deviceId) {
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/device/' + deviceId;
|
|
|
|
|
$http.delete(url).then(function success() {
|
|
|
|
|
deferred.resolve();
|
2017-04-23 18:04:55 +03:00
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
2016-12-01 11:40:28 +02:00
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-21 20:05:03 +02:00
|
|
|
function getDeviceCredentials(deviceId, sync) {
|
2016-12-01 11:40:28 +02:00
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/device/' + deviceId + '/credentials';
|
2018-02-21 20:05:03 +02:00
|
|
|
if (sync) {
|
|
|
|
|
var request = new $window.XMLHttpRequest();
|
|
|
|
|
request.open('GET', url, false);
|
|
|
|
|
request.setRequestHeader("Accept", "application/json, text/plain, */*");
|
|
|
|
|
userService.setAuthorizationRequestHeader(request);
|
|
|
|
|
request.send(null);
|
|
|
|
|
if (request.status === 200) {
|
|
|
|
|
deferred.resolve(angular.fromJson(request.responseText));
|
|
|
|
|
} else {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$http.get(url, null).then(function success(response) {
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-12-01 11:40:28 +02:00
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveDeviceCredentials(deviceCredentials) {
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/device/credentials';
|
|
|
|
|
$http.post(url, deviceCredentials).then(function success(response) {
|
|
|
|
|
deferred.resolve(response.data);
|
2017-04-23 18:04:55 +03:00
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
2016-12-01 11:40:28 +02:00
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function assignDeviceToCustomer(customerId, deviceId) {
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/customer/' + customerId + '/device/' + deviceId;
|
2017-04-23 18:04:55 +03:00
|
|
|
$http.post(url, null).then(function success(response) {
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
2016-12-01 11:40:28 +02:00
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function unassignDeviceFromCustomer(deviceId) {
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/customer/device/' + deviceId;
|
2017-04-23 18:04:55 +03:00
|
|
|
$http.delete(url).then(function success(response) {
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function makeDevicePublic(deviceId) {
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/customer/public/device/' + deviceId;
|
|
|
|
|
$http.post(url, null).then(function success(response) {
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
2016-12-01 11:40:28 +02:00
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-17 12:21:12 +03:00
|
|
|
function getDeviceAttributes(deviceId, attributeScope, query, successCallback, config) {
|
2017-05-24 10:39:33 +03:00
|
|
|
return attributeService.getEntityAttributes(types.entityType.device, deviceId, attributeScope, query, successCallback, config);
|
2016-12-01 11:40:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function subscribeForDeviceAttributes(deviceId, attributeScope) {
|
2017-05-24 10:39:33 +03:00
|
|
|
return attributeService.subscribeForEntityAttributes(types.entityType.device, deviceId, attributeScope);
|
2016-12-01 11:40:28 +02:00
|
|
|
}
|
2017-05-24 10:39:33 +03:00
|
|
|
|
2016-12-01 11:40:28 +02:00
|
|
|
function unsubscribeForDeviceAttributes(subscriptionId) {
|
2017-05-24 10:39:33 +03:00
|
|
|
attributeService.unsubscribeForEntityAttributes(subscriptionId);
|
2016-12-01 11:40:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveDeviceAttributes(deviceId, attributeScope, attributes) {
|
2017-05-24 10:39:33 +03:00
|
|
|
return attributeService.saveEntityAttributes(types.entityType.device, deviceId, attributeScope, attributes);
|
2016-12-01 11:40:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteDeviceAttributes(deviceId, attributeScope, attributes) {
|
2017-05-24 10:39:33 +03:00
|
|
|
return attributeService.deleteEntityAttributes(types.entityType.device, deviceId, attributeScope, attributes);
|
2016-12-01 11:40:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sendOneWayRpcCommand(deviceId, requestBody) {
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/plugins/rpc/oneway/' + deviceId;
|
|
|
|
|
$http.post(url, requestBody).then(function success(response) {
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}, function fail(rejection) {
|
|
|
|
|
deferred.reject(rejection);
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sendTwoWayRpcCommand(deviceId, requestBody) {
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/plugins/rpc/twoway/' + deviceId;
|
|
|
|
|
$http.post(url, requestBody).then(function success(response) {
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}, function fail(rejection) {
|
|
|
|
|
deferred.reject(rejection);
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-24 10:39:33 +03:00
|
|
|
function findByQuery(query, ignoreErrors, config) {
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/devices';
|
|
|
|
|
if (!config) {
|
|
|
|
|
config = {};
|
|
|
|
|
}
|
2019-05-20 11:57:43 +03:00
|
|
|
config = Object.assign(config, {ignoreErrors: ignoreErrors});
|
2017-05-24 10:39:33 +03:00
|
|
|
$http.post(url, query, config).then(function success(response) {
|
|
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-29 19:09:34 +02:00
|
|
|
function getDeviceTypes(config) {
|
2017-05-28 18:23:05 +03:00
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/device/types';
|
2017-12-29 19:09:34 +02:00
|
|
|
$http.get(url, config).then(function success(response) {
|
2017-05-28 18:23:05 +03:00
|
|
|
deferred.resolve(response.data);
|
|
|
|
|
}, function fail() {
|
|
|
|
|
deferred.reject();
|
|
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 11:57:43 +03:00
|
|
|
function findByName(deviceName, config) {
|
|
|
|
|
config = config || {};
|
|
|
|
|
var deferred = $q.defer();
|
|
|
|
|
var url = '/api/tenant/devices?deviceName=' + deviceName;
|
|
|
|
|
$http.get(url, config).then(function success(response) {
|
|
|
|
|
deferred.resolve(response.data);
|
2019-05-21 19:00:52 +03:00
|
|
|
}, function fail(response) {
|
|
|
|
|
deferred.reject(response);
|
2019-05-20 11:57:43 +03:00
|
|
|
});
|
|
|
|
|
return deferred.promise;
|
|
|
|
|
}
|
2016-12-01 11:40:28 +02:00
|
|
|
}
|