fix: machine unpair breaks the UI
Purging db tables upon unpairing from the server will prevent later UI crashes caused by working with a NULL value.
This commit is contained in:
parent
7f49684b67
commit
0288b6b5c0
1 changed files with 2 additions and 1 deletions
|
|
@ -15,9 +15,10 @@ function pullToken (token) {
|
||||||
function unpair (deviceId) {
|
function unpair (deviceId) {
|
||||||
const sql = 'delete from devices where device_id=$1'
|
const sql = 'delete from devices where device_id=$1'
|
||||||
const deleteMachinePings = 'delete from machine_pings where device_id=$1'
|
const deleteMachinePings = 'delete from machine_pings where device_id=$1'
|
||||||
|
const deleteMachineHeartbeat = 'delete from machine_network_heartbeat where device_id=$1'
|
||||||
|
|
||||||
// TODO new-admin: We should remove all configs related to that device. This can get tricky.
|
// TODO new-admin: We should remove all configs related to that device. This can get tricky.
|
||||||
return Promise.all([db.none(sql, [deviceId]), db.none(deleteMachinePings, [deviceId])])
|
return Promise.all([db.none(sql, [deviceId]), db.none(deleteMachinePings, [deviceId]), db.none(deleteMachineHeartbeat, [deviceId])])
|
||||||
}
|
}
|
||||||
|
|
||||||
function pair (token, deviceId, machineModel) {
|
function pair (token, deviceId, machineModel) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue