We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e9762c commit e690478Copy full SHA for e690478
src/hooks/useAutoThemeSwitcher.ts
@@ -3,10 +3,8 @@ import type { AppStore } from '@/stores/modules/app'
3
export default function useAutoThemeSwitcher(appStore: AppStore) {
4
const handleAttributeChange = () => {
5
const rootElement = document.documentElement
6
- if (rootElement.classList.contains('dark'))
7
- appStore.switchMode('dark')
8
- else
9
- appStore.switchMode('light')
+ const mode = rootElement.classList.contains('dark') ? 'dark' : 'light'
+ appStore.switchMode(mode)
10
}
11
12
const observerOptions = {
0 commit comments