Removed informational and debug console.log statements from src/index.js, src/actions.js, and src/ui_helpers.js to improve code health and user experience. Refactored src/index.js to avoid empty blocks. Co-authored-by: TauNeutrino <1600410+TauNeutrino@users.noreply.github.com>
32 lines
831 B
JavaScript
32 lines
831 B
JavaScript
import { injectUI } from './ui.js';
|
|
import { bindEvents } from './events.js';
|
|
import { updateAuthUI, cleanupExpiredFlags, loadMenuCache, isCacheFresh, loadMenuDataFromAPI, startPolling } from './actions.js';
|
|
import { checkForUpdates } from './ui_helpers.js';
|
|
import { authToken } from './state.js';
|
|
|
|
if (!window.__KANTINE_LOADED) {
|
|
window.__KANTINE_LOADED = true;
|
|
|
|
injectUI();
|
|
bindEvents();
|
|
updateAuthUI();
|
|
cleanupExpiredFlags();
|
|
|
|
const hadCache = loadMenuCache();
|
|
if (hadCache) {
|
|
document.getElementById('loading').classList.add('hidden');
|
|
if (!isCacheFresh()) {
|
|
loadMenuDataFromAPI();
|
|
}
|
|
} else {
|
|
loadMenuDataFromAPI();
|
|
}
|
|
|
|
if (authToken) {
|
|
startPolling();
|
|
}
|
|
|
|
checkForUpdates();
|
|
setInterval(checkForUpdates, 60 * 60 * 1000);
|
|
}
|