fix: i18n SSR
This commit is contained in:
parent
d09b4deb52
commit
970b6538e2
5 changed files with 24 additions and 23 deletions
|
@ -1,9 +1,9 @@
|
|||
import type { ColorMode } from '~/types'
|
||||
import { InjectionKeyColorMode } from '~/constants/symbols'
|
||||
import { COOKIE_KEY_COLOR_MODE } from '~/constants'
|
||||
import { COOKIE_KEY_COLOR_MODE, COOKIE_MAX_AGE } from '~/constants'
|
||||
|
||||
export default defineNuxtPlugin((nuxt) => {
|
||||
const cookieColorMode = useCookie<ColorMode | null>(COOKIE_KEY_COLOR_MODE, { default: () => null })
|
||||
const cookieColorMode = useCookie<ColorMode | null>(COOKIE_KEY_COLOR_MODE, { maxAge: COOKIE_MAX_AGE })
|
||||
|
||||
const preferColorMode = process.server ? computed(() => 'light') : usePreferredColorScheme()
|
||||
const colorMode = computed<ColorMode>({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue