windows/stores/settings.ts

23 lines
429 B
TypeScript
Raw Permalink Normal View History

2025-09-23 16:43:57 +00:00
import { defineStore } from 'pinia';
export type Theme = 'dark' | 'light';
interface SettingsState {
theme: Theme;
}
export const useSettingsStore = defineStore('settings', {
state: (): SettingsState => ({
theme: 'dark', // Default theme
}),
actions: {
setTheme(theme: Theme) {
this.theme = theme;
},
toggleTheme() {
this.theme = this.theme === 'light' ? 'dark' : 'light';
},
},
});