mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 00:03:28 +02:00
Fix express warning for deprecated res.json(stat) message
This commit is contained in:
@@ -41,7 +41,7 @@ function getCurrentUserDevices(req, res) {
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.error('Failed to load group: ', err.stack)
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
})
|
||||
})
|
||||
@@ -79,19 +79,19 @@ function addDeviceToUser(req, res) {
|
||||
)
|
||||
])
|
||||
|
||||
res.json(202, {
|
||||
res.status(202).json({
|
||||
success: true
|
||||
, description: 'Device Add request is accepted'
|
||||
})
|
||||
|
||||
} else {
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
, description: 'Device is being used or not available'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
, description: 'Bad device serial'
|
||||
})
|
||||
@@ -124,19 +124,19 @@ function deleteDeviceFromUser(req, res) {
|
||||
)
|
||||
])
|
||||
|
||||
res.json(202, {
|
||||
res.status(202).json({
|
||||
success: true
|
||||
, description: 'Device Release request is accepted'
|
||||
})
|
||||
|
||||
} else {
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
, description: 'You cannot kick this device'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
, description: 'Bad device serial'
|
||||
})
|
||||
@@ -164,21 +164,21 @@ function getUserDeviceBySerial(req, res) {
|
||||
})
|
||||
}
|
||||
else {
|
||||
res.json(404, {
|
||||
res.status(404).json({
|
||||
success: false
|
||||
, description: 'device is not owned by you'
|
||||
})
|
||||
}
|
||||
}
|
||||
else {
|
||||
res.json(404, {
|
||||
res.status(404).json({
|
||||
success: false
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.error('Failed to load device "%s": ', req.params.serial, err.stack)
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
})
|
||||
})
|
||||
@@ -200,20 +200,20 @@ function connectDeviceBySerial(req, res) {
|
||||
)
|
||||
])
|
||||
|
||||
res.json(202, {
|
||||
res.status(202).json({
|
||||
success: true
|
||||
, description: 'Device Connect request is accepted'
|
||||
})
|
||||
}
|
||||
else {
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
, description: 'Device is not owned by you or is not available'
|
||||
})
|
||||
}
|
||||
}
|
||||
else {
|
||||
res.json(404, {
|
||||
res.status(404).json({
|
||||
success: false
|
||||
, description: 'Bad device serial'
|
||||
})
|
||||
@@ -221,7 +221,7 @@ function connectDeviceBySerial(req, res) {
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.error('Failed to load device "%s": ', req.params.serial, err.stack)
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
})
|
||||
})
|
||||
@@ -243,20 +243,20 @@ function disconnectDeviceBySerial(req, res) {
|
||||
)
|
||||
])
|
||||
|
||||
res.json(202, {
|
||||
res.status(202).json({
|
||||
success: true
|
||||
, description: 'Device Disonnect request is accepted'
|
||||
})
|
||||
}
|
||||
else {
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
, description: 'Device is not owned by you or is not available'
|
||||
})
|
||||
}
|
||||
}
|
||||
else {
|
||||
res.json(404, {
|
||||
res.status(404).json({
|
||||
success: false
|
||||
, description: 'Bad device serial'
|
||||
})
|
||||
@@ -264,7 +264,7 @@ function disconnectDeviceBySerial(req, res) {
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.error('Failed to load device "%s": ', req.params.serial, err.stack)
|
||||
res.json(500, {
|
||||
res.status(500).json({
|
||||
success: false
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user