33 lines
769 B
JavaScript
33 lines
769 B
JavaScript
store.commit('setEvent', {
|
|
subject:"wifictld_pkg",
|
|
callback: (state, msg) => {
|
|
|
|
// add to ap list
|
|
const ip = msg.body.ip;
|
|
if(state.controller._ap[ip] === undefined){
|
|
state.controller.ap.push(ip)
|
|
state.controller._ap[ip] = null;
|
|
}
|
|
|
|
// add clients
|
|
const client = msg.body.msg.client;
|
|
if (state.controller.clients[client.addr] === undefined) {
|
|
state.controller._clients.push(client.addr)
|
|
}
|
|
client.ap = ip;
|
|
state.controller.clients[client.addr] = client;
|
|
}
|
|
})
|
|
|
|
VueNativeSock.default.install(Vue, `//${location.host}${location.pathname}ws`, {
|
|
store: store,
|
|
reconnection: true,
|
|
reconnectionDelay: 5000,
|
|
format: 'json',
|
|
})
|
|
|
|
|
|
getJSON(`//${location.host}${location.pathname}data.json`).then(function(data){
|
|
store.commit('initData',data);
|
|
})
|