fix: locale match error

pull/115/head
金伟强 3 years ago
parent 8fc2663693
commit e7da58ba1e

@ -23,7 +23,11 @@ export const getLocale = (request: NextRequest): Locale => {
} }
// match locale // match locale
const matchedLocale = match(languages, locales, i18n.defaultLocale) as Locale let matchedLocale:Locale = i18n.defaultLocale
try {
// If languages is ['*'], Error would happen in match function.
matchedLocale = match(languages, locales, i18n.defaultLocale) as Locale
} catch(e) {}
return matchedLocale return matchedLocale
} }

Loading…
Cancel
Save