diff options
Diffstat (limited to 'web/app')
-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); + } + } }); } }); |