断线重连
This commit is contained in:
parent
bc6936def1
commit
f10fe2843e
11
index.ts
11
index.ts
@ -138,8 +138,9 @@ async function connectAPI() {
|
||||
}
|
||||
|
||||
async function getDHCPList(addr: string | null) {
|
||||
const result = await api.write('/ip/dhcp-server/lease/print');
|
||||
list = [];
|
||||
try {
|
||||
const result = await api.write('/ip/dhcp-server/lease/print');
|
||||
for (let eq in result) {
|
||||
let format = {
|
||||
id: result[eq]['.id'],
|
||||
@ -161,6 +162,14 @@ async function getDHCPList(addr: string | null) {
|
||||
}
|
||||
list.push(format);
|
||||
}
|
||||
} catch (e) {
|
||||
api = new RouterOSAPI({
|
||||
host: cfg.host,
|
||||
user: cfg.user,
|
||||
password: cfg.password,
|
||||
});
|
||||
api.connect();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user