uci-wifi/src/disconnect.js

14 lines
439 B
JavaScript
Raw Normal View History

import cmd from './cmd'
import tc from '@uci/try-catch'
2019-01-01 20:13:14 -08:00
async function disconnect(iface) {
if (!iface) return { error: 'can not disconnect - no interface given' }
let cmdStr = `nmcli device disconnect ${iface}`
let ret = await tc(cmd)(cmdStr)
2019-01-01 20:13:14 -08:00
if (ret.err)
return { error: 'disconnect failed', cmd: ret.err.cmd, message: ret.err }
return { disconnect: 'success', iface: iface }
} // end disconnect
2019-01-01 20:13:14 -08:00
export default disconnect