fix: undefined browser (#3011)

electron is not available
This commit is contained in:
phoval 2024-06-10 05:13:27 +02:00 committed by GitHub
parent 0cae7c9761
commit 57177d4409
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,11 +29,11 @@ export const useLoadTheme = async () => {
const setNativeTheme = useCallback( const setNativeTheme = useCallback(
(nativeTheme: NativeThemeProps) => { (nativeTheme: NativeThemeProps) => {
if (nativeTheme === 'dark') { if (nativeTheme === 'dark') {
window?.electronAPI.setNativeThemeDark() window?.electronAPI?.setNativeThemeDark()
setTheme('dark') setTheme('dark')
localStorage.setItem('nativeTheme', 'dark') localStorage.setItem('nativeTheme', 'dark')
} else { } else {
window?.electronAPI.setNativeThemeLight() window?.electronAPI?.setNativeThemeLight()
setTheme('light') setTheme('light')
localStorage.setItem('nativeTheme', 'light') localStorage.setItem('nativeTheme', 'light')
} }