Skip to content

Commit

Permalink
fix: fixing stale state
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrannychaseroperation committed Feb 16, 2025
1 parent 484fa86 commit d1dc27a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/events/themes/toggle-custom-theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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);

0 comments on commit d1dc27a

Please sign in to comment.