add theme selector

This commit is contained in:
SethBurkart123
2023-11-02 16:13:45 +11:00
parent 5c23ba0381
commit 46e86b9643
4 changed files with 23 additions and 2 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ import localforage from "localforage";
// Utility function to fetch and parse JSON
const fetchJSON = async (url) => {
const res = await fetch(url);
const res = await fetch(url, {cache: "no-store"});
return await res.json();
};
@@ -71,11 +71,11 @@ export const downloadTheme = async (themeName, themeUrl) => {
const themeData = await fetchThemeJSON(themeUrl);
await saveToIndexedDB(themeData, themeName);
console.log(`Theme ${themeName} saved to IndexedDB`);
setTheme(themeName);
return;
};
export const setTheme = async (themeName, themeUrl) => {
await downloadTheme(themeName, themeUrl);
if (!(await themeExistsInDB(themeName))) {
await downloadTheme(themeName, themeUrl);
}
+1
View File
@@ -15,6 +15,7 @@ export class MessageHandler {
this.editSidebar();
break;
case "SetTheme":
console.log(request);
setTheme(request.body.themeName, request.body.themeURL);
break;
case "DownloadTheme":