mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 08:43:45 +02:00
Make sure we've invited the device when we go to the control page. Refuse to show the control page on failure.
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
module.exports = function DeviceControlCtrl($scope, $routeParams, DeviceService, ControlService) {
|
||||
module.exports = function DeviceControlCtrl($scope, $routeParams, $location, DeviceService, GroupService, ControlService) {
|
||||
$scope.control = null
|
||||
$scope.device = {
|
||||
promise: DeviceService.get($routeParams.serial)
|
||||
.then(function(device) {
|
||||
return GroupService.invite(device)
|
||||
})
|
||||
.then(function(device) {
|
||||
$scope.device.value = device
|
||||
$scope.control = ControlService.forOne(device, device.channel)
|
||||
return device
|
||||
})
|
||||
.catch(function(err) {
|
||||
$location.path('/')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user