Cache First Menu
At Menu.js
change the load
method with the following one and analyze the database created and the algorithm.
load: async () => {
// Cache First
const db = await Menu.openDB();
if (await db.count('categories') == 0) {
const data = await API.fetchMenu();
data.forEach(category => db.add('categories', category));
}
Menu.data = await db.getAll('categories');
Menu.render();
}