Files
hydra/src/main/events/themes/toggle-custom-theme.ts
Chubby Granny Chaser d1dc27aef6 fix: fixing stale state
2025-02-16 05:27:16 +00:00

23 lines
488 B
TypeScript

import { themesSublevel } from "@main/level";
import { registerEvent } from "../register-event";
const toggleCustomTheme = async (
_event: Electron.IpcMainInvokeEvent,
themeId: string,
isActive: boolean
) => {
const theme = await themesSublevel.get(themeId);
if (!theme) {
throw new Error("Theme not found");
}
await themesSublevel.put(themeId, {
...theme,
isActive,
updatedAt: new Date(),
});
};
registerEvent("toggleCustomTheme", toggleCustomTheme);