mirror of
https://github.com/umami-software/umami.git
synced 2026-02-17 19:15:37 +01:00
Fix issue with server build.
This commit is contained in:
parent
a22f22a8ba
commit
5f41447158
1 changed files with 6 additions and 1 deletions
|
|
@ -5,7 +5,12 @@ import { THEME_CONFIG } from 'lib/constants';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
export default function useTheme() {
|
export default function useTheme() {
|
||||||
const defaultTheme = window?.matchMedia('prefers-color-scheme: dark')?.matches ? 'dark' : 'light';
|
const defaultTheme =
|
||||||
|
typeof window !== undefined
|
||||||
|
? window?.matchMedia('prefers-color-scheme: dark')?.matches
|
||||||
|
? 'dark'
|
||||||
|
: 'light'
|
||||||
|
: 'light';
|
||||||
const theme = useSelector(state => state.app.theme || getItem(THEME_CONFIG) || defaultTheme);
|
const theme = useSelector(state => state.app.theme || getItem(THEME_CONFIG) || defaultTheme);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue