aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-07 10:44:16 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-07 10:44:16 +1300
commit8ce214876cb4c55c242e46fb004adeca16d3b23b (patch)
treead3ad3a51ca476da3517fb62cfbc8f7d4ca8b7f1 /web/app/view
parente5b44532710862eb404563c4e83d104be4b2680b (diff)
downloadtrackermap-server-8ce214876cb4c55c242e46fb004adeca16d3b23b.tar.gz
trackermap-server-8ce214876cb4c55c242e46fb004adeca16d3b23b.tar.bz2
trackermap-server-8ce214876cb4c55c242e46fb004adeca16d3b23b.zip
Implement device permissions REST API
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/UserDevicesController.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/web/app/view/UserDevicesController.js b/web/app/view/UserDevicesController.js
index aeb99c21c..4cbc6889a 100644
--- a/web/app/view/UserDevicesController.js
+++ b/web/app/view/UserDevicesController.js
@@ -47,24 +47,33 @@ Ext.define('Traccar.view.UserDevicesController', {
onBeforeSelect: function (object, record, index) {
Ext.Ajax.request({
scope: this,
- url: '/api/device/link',
- params: {
+ url: '/api/rest/permissions',
+ jsonData: {
userId: this.userId,
deviceId: record.getData().id
},
- callback: Traccar.app.getErrorHandler()
+ callback: function (options, success, response) {
+ if (!success) {
+ Traccar.app.showError(response);
+ }
+ }
});
},
onBeforeDeselect: function (object, record, index) {
Ext.Ajax.request({
scope: this,
+ method: 'DELETE',
url: '/api/device/unlink',
- params: {
+ jsonData: {
userId: this.userId,
deviceId: record.getData().id
},
- callback: Traccar.app.getErrorHandler()
+ callback: function (options, success, response) {
+ if (!success) {
+ Traccar.app.showError(response);
+ }
+ }
});
}
});