uci-wifi/src/disconnect.js

14 lines
439 B
JavaScript

import cmd from './cmd'
import tc from '@uci/try-catch'
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)
if (ret.err)
return { error: 'disconnect failed', cmd: ret.err.cmd, message: ret.err }
return { disconnect: 'success', iface: iface }
} // end disconnect
export default disconnect