Fix delayed loading

This commit is contained in:
Matthias 2021-10-05 21:06:23 +02:00
parent c2a1f9cf3b
commit 42161bb848
2 changed files with 9 additions and 6 deletions

View File

@ -279,7 +279,7 @@ export default function createBotStore(store) {
startRefresh({ state, dispatch, commit }) { startRefresh({ state, dispatch, commit }) {
console.log('Starting automatic refresh.'); console.log('Starting automatic refresh.');
dispatch('allRefreshFrequent', false); dispatch('allRefreshFull');
if (!state.refreshInterval) { if (!state.refreshInterval) {
// Set interval for refresh // Set interval for refresh
@ -288,7 +288,6 @@ export default function createBotStore(store) {
}, 5000); }, 5000);
commit('setRefreshInterval', refreshInterval); commit('setRefreshInterval', refreshInterval);
} }
dispatch('allRefreshSlow', false);
if (!state.refreshIntervalSlow) { if (!state.refreshIntervalSlow) {
const refreshIntervalSlow = window.setInterval(() => { const refreshIntervalSlow = window.setInterval(() => {
dispatch('allRefreshSlow', false); dispatch('allRefreshSlow', false);
@ -308,10 +307,12 @@ export default function createBotStore(store) {
} }
}, },
pingAll({ getters, dispatch }) { async pingAll({ getters, dispatch }) {
getters.allAvailableBotsList.forEach((e) => { await Promise.all(
dispatch(`${e}/ping`); getters.allAvailableBotsList.map(async (e) => {
}); await dispatch(`${e}/ping`);
}),
);
}, },
allGetState({ getters, dispatch }) { allGetState({ getters, dispatch }) {
getters.allAvailableBotsList.forEach((e) => { getters.allAvailableBotsList.forEach((e) => {

View File

@ -433,8 +433,10 @@ export function createBotSubStore(botId: string, botName: string) {
const result = await api.get('/ping'); const result = await api.get('/ping');
commit('setPing', result.data); commit('setPing', result.data);
commit('setIsBotOnline', true); commit('setIsBotOnline', true);
return Promise.resolve();
} catch (error) { } catch (error) {
// //
return Promise.reject();
} }
}, },
[BotStoreActions.logout]() { [BotStoreActions.logout]() {