diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-31 12:04:28 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-31 12:04:28 +0100 |
commit | 02d6e77bd180cbbf6f7f6e1a69c670e922d8204d (patch) | |
tree | c55847b71e589f79ce6537f2b61f3691fe8bf220 /web/static/app/DillerRpc.js | |
parent | dd72e7992f126c4a42a0791228400738072f297d (diff) | |
download | diller-server-02d6e77bd180cbbf6f7f6e1a69c670e922d8204d.tar.gz diller-server-02d6e77bd180cbbf6f7f6e1a69c670e922d8204d.tar.bz2 diller-server-02d6e77bd180cbbf6f7f6e1a69c670e922d8204d.tar.xz diller-server-02d6e77bd180cbbf6f7f6e1a69c670e922d8204d.zip |
web:
o Starting on edit button for device name.
Diffstat (limited to 'web/static/app/DillerRpc.js')
-rw-r--r-- | web/static/app/DillerRpc.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/web/static/app/DillerRpc.js b/web/static/app/DillerRpc.js index de90aee..b1939f4 100644 --- a/web/static/app/DillerRpc.js +++ b/web/static/app/DillerRpc.js @@ -16,6 +16,15 @@ function DillerRpc($http, DillerConfig) { return $http(req); } + function patchDevice(deviceId, payload) { + var req = {}; + req.method = 'patch'; + req.url = baseUrl + '/api/device/:deviceId'; + req.url = req.url.replace(/:deviceId/, deviceId); + req.data = payload; + return $http(req); + } + function getValues(propertyId) { var req = {}; req.method = 'get'; @@ -27,6 +36,7 @@ function DillerRpc($http, DillerConfig) { return { getDevices: getDevices, getDevice: getDevice, + patchDevice: patchDevice, getValues: getValues }; } @@ -38,6 +48,9 @@ DillerRpcResolve.getDevices = function(DillerRpc) { DillerRpcResolve.getDevice = function(DillerRpc, $route) { return DillerRpc.getDevice($route.current.params.deviceId); }; +DillerRpcResolve.patchDevice = function(DillerRpc, $route) { + return DillerRpc.patchDevice($route.current.params.deviceId, $route.current.params.payload); +}; DillerRpcResolve.getValues = function(DillerRpc, $route) { return DillerRpc.getValues($route.current.params.propertyId); }; |