mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +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)
|
||||
if (process.server) {
|
||||
// Learn more about the nuxtApp interface on https://v3.nuxtjs.org/docs/usage/nuxt-app#nuxtapp-interface-advanced
|
||||
const nuxtApp = useNuxtApp()
|
||||
const reqLocale = nuxtApp.ssrContext?.req.headers['accept-language']?.split(',')[0]
|
||||
const reqLocale = useRequestHeaders()['accept-language']?.split(',')[0]
|
||||
if (reqLocale) {
|
||||
locale.value = reqLocale
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user