mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: fixing stale state
This commit is contained in:
parent
484fa863dc
commit
d1dc27aef6
1 changed files with 22 additions and 0 deletions
22
src/main/events/themes/toggle-custom-theme.ts
Normal file
22
src/main/events/themes/toggle-custom-theme.ts
Normal file
|
@ -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);
|
Loading…
Add table
Add a link
Reference in a new issue