From 8ce214876cb4c55c242e46fb004adeca16d3b23b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 7 Dec 2015 10:44:16 +1300 Subject: Implement device permissions REST API --- web/app/view/UserDevicesController.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'web') 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); + } + } }); } }); -- cgit v1.2.3