mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
chore(examples): update event context (#8814)
This commit is contained in:
parent
10c2272f4f
commit
f26c97f05a
@ -6,8 +6,7 @@ export const useDefaultLocale = (fallback = 'en-US') => {
|
|||||||
const locale = ref(fallback)
|
const locale = ref(fallback)
|
||||||
if (process.server) {
|
if (process.server) {
|
||||||
// Learn more about the nuxtApp interface on https://v3.nuxtjs.org/docs/usage/nuxt-app#nuxtapp-interface-advanced
|
// Learn more about the nuxtApp interface on https://v3.nuxtjs.org/docs/usage/nuxt-app#nuxtapp-interface-advanced
|
||||||
const nuxtApp = useNuxtApp()
|
const reqLocale = useRequestHeaders()['accept-language']?.split(',')[0]
|
||||||
const reqLocale = nuxtApp.ssrContext?.req.headers['accept-language']?.split(',')[0]
|
|
||||||
if (reqLocale) {
|
if (reqLocale) {
|
||||||
locale.value = reqLocale
|
locale.value = reqLocale
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user