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(
(nativeTheme: NativeThemeProps) => {
if (nativeTheme === 'dark') {
window?.electronAPI.setNativeThemeDark()
window?.electronAPI?.setNativeThemeDark()
setTheme('dark')
localStorage.setItem('nativeTheme', 'dark')
} else {
window?.electronAPI.setNativeThemeLight()
window?.electronAPI?.setNativeThemeLight()
setTheme('light')
localStorage.setItem('nativeTheme', 'light')
}