fix(ThemeCreator): coverimage not loading on edit

This commit is contained in:
sethburkart123
2024-10-07 15:35:56 +11:00
parent 83b0e8de3f
commit b404828f0e
4 changed files with 14 additions and 9 deletions
+3 -3
View File
@@ -1,10 +1,10 @@
import localforage from 'localforage';
import type { CustomTheme } from '@/types/CustomThemes';
import type { LoadedCustomTheme } from '@/types/CustomThemes';
export const getTheme = async (themeId: string): Promise<CustomTheme | null> => {
export const getTheme = async (themeId: string): Promise<LoadedCustomTheme | null> => {
try {
const theme = await localforage.getItem(themeId) as CustomTheme;
const theme = await localforage.getItem(themeId) as LoadedCustomTheme;
return theme;
} catch (error) {
+2 -2
View File
@@ -1,6 +1,7 @@
import localforage from 'localforage';
import type { LoadedCustomTheme } from '@/types/CustomThemes';
import { disableTheme } from './disableTheme';
import { themeUpdates } from '@/svelte-interface/hooks/ThemeUpdates';
export const saveTheme = async (theme: LoadedCustomTheme) => {
@@ -9,9 +10,7 @@ export const saveTheme = async (theme: LoadedCustomTheme) => {
console.debug('Theme to save:', theme);
console.log('stage 1')
await localforage.setItem(theme.id, theme);
console.log('stage 2')
await localforage.getItem('customThemes').then((themes: unknown) => {
const themeList = themes as string[] | null;
if (themeList) {
@@ -24,6 +23,7 @@ export const saveTheme = async (theme: LoadedCustomTheme) => {
}
});
console.debug('Theme saved successfully!');
themeUpdates.triggerUpdate();
} catch (error) {
console.error('Error saving theme:', error);
}