fix: simplify local dark theme selection and fix #332

This commit is contained in:
lesion 2024-01-19 00:36:35 +01:00
parent 67d2ee31a2
commit 223437f9c1
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -4,9 +4,7 @@ import { ca, cs, de, en, es, eu, fr, gl, it, nb, nl, pl, pt, tr, sk, ro, ru, zhH
export default ({ res, nuxtState }) => {
const settings = process.server ? (res.locals.settings || {}) : nuxtState.state.settings || {}
const is_dark = process.client
? (typeof nuxtState.state.localSettings['theme.is_dark'] !== 'undefined' ? nuxtState.state.localSettings['theme.is_dark'] : settings['theme.is_dark'])
: settings['theme.is_dark']
const is_dark = nuxtState?.state?.localSettings['theme.is_dark'] ?? settings['theme.is_dark']
return {
lang: { locales: { ca, cs, de, en, es, eu, fr, gl, it, nb, nl, pl, pt, sk, tr, ro, ru, zhHans } },