mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix theme warning
This commit is contained in:
@@ -8,7 +8,7 @@ interface ThemeState {
|
||||
};
|
||||
currentTheme: string | null;
|
||||
setTheme: (category: keyof ThemeState['themes'], theme: string) => void;
|
||||
getTheme: (category: keyof ThemeState['themes']) => string | null;
|
||||
getTheme: (category: keyof ThemeState['themes'], updateCurrentTheme?: boolean) => string | null;
|
||||
loadThemes: () => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -29,10 +29,12 @@ const useThemeStore = create<ThemeState>((set: StoreApi<ThemeState>['setState'],
|
||||
await themeStore.setItem(category, theme);
|
||||
set({ themes: updatedThemes, currentTheme: theme });
|
||||
},
|
||||
getTheme: (category) => {
|
||||
getTheme: (category, updateCurrentTheme = true) => {
|
||||
const currentThemes = get().themes;
|
||||
const theme = currentThemes[category] || null;
|
||||
set({ currentTheme: theme });
|
||||
if (updateCurrentTheme) {
|
||||
set({ currentTheme: theme });
|
||||
}
|
||||
return theme;
|
||||
},
|
||||
loadThemes: async () => {
|
||||
|
||||
Reference in New Issue
Block a user