fix: i18n SSR
This commit is contained in:
parent
d09b4deb52
commit
970b6538e2
5 changed files with 24 additions and 23 deletions
|
@ -1,11 +1,11 @@
|
|||
import type { FontSize } from '~/types'
|
||||
import { InjectionKeyFontSize } from '~/constants/symbols'
|
||||
import { COOKIE_KEY_FONT_SIZE } from '~/constants'
|
||||
import { COOKIE_KEY_FONT_SIZE, COOKIE_MAX_AGE } from '~/constants'
|
||||
import { fontSizeMap } from '~/constants/options'
|
||||
|
||||
export default defineNuxtPlugin((nuxt) => {
|
||||
const DEFAULT = 'md'
|
||||
const cookieFontSize = useCookie<FontSize>(COOKIE_KEY_FONT_SIZE, { default: () => DEFAULT })
|
||||
const cookieFontSize = useCookie<FontSize>(COOKIE_KEY_FONT_SIZE, { default: () => DEFAULT, maxAge: COOKIE_MAX_AGE })
|
||||
nuxt.vueApp.provide(InjectionKeyFontSize, cookieFontSize)
|
||||
|
||||
if (!process.server) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue