Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
NETWORK_CONNECT({ commit, dispatch, state }) {
const { config, client } = state;
if (client && client.isConnected()) {
client.disconnect();
}
const clientToConnect = client || new Client();
clientToConnect
.connect(config)
.then((validClient) => {
commit(Mutations.NETWORK_CLIENT_SET, validClient);
dispatch(Actions.TIME_FETCH_ACTIVE_INDEX);
dispatch(Actions.PROXY_PIPELINE_FETCH);
dispatch(Actions.APP_ROUTE_RUN);
dispatch(Actions.COLOR_FETCH_PRESET_NAMES, 500);
})
.catch((error) => {
console.error(error);
});
clientToConnect.setBusyCallback((count) => {
commit(Mutations.BUSY_COUNT_SET, count);
});
PVL_NETWORK_CONNECT({ commit, dispatch, state }) {
const { config, client } = state;
if (client && client.isConnected()) {
client.disconnect();
}
const clientToConnect = client || new Client();
clientToConnect.setBusyCallback((count) => {
commit('PVL_BUSY_COUNT_SET', count);
});
clientToConnect.updateBusy(+1);
clientToConnect.setConnectionErrorCallback((type, httpReq) => {
const message =
(httpReq && httpReq.response && httpReq.response.error) ||
`Connection ${type}`;
console.error(message);
console.log(httpReq);
});
clientToConnect