diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-07 10:44:16 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-07 10:44:16 +1300 |
commit | 8ce214876cb4c55c242e46fb004adeca16d3b23b (patch) | |
tree | ad3ad3a51ca476da3517fb62cfbc8f7d4ca8b7f1 /web | |
parent | e5b44532710862eb404563c4e83d104be4b2680b (diff) | |
download | trackermap-server-8ce214876cb4c55c242e46fb004adeca16d3b23b.tar.gz trackermap-server-8ce214876cb4c55c242e46fb004adeca16d3b23b.tar.bz2 trackermap-server-8ce214876cb4c55c242e46fb004adeca16d3b23b.zip |
Implement device permissions REST API
Diffstat (limited to 'web')
-rw-r--r-- | web/app/view/UserDevicesController.js | 19 |
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); + } + } }); } }); |