mirror of https://github.com/langgenius/dify.git
fix: headers to v15
This commit is contained in:
parent
f981eb4640
commit
a465f092eb
|
|
@ -18,13 +18,13 @@ export type IGAProps = {
|
|||
gaType: GaType
|
||||
}
|
||||
|
||||
const GA: FC<IGAProps> = ({
|
||||
const GA: FC<IGAProps> = async ({
|
||||
gaType,
|
||||
}) => {
|
||||
if (IS_CE_EDITION)
|
||||
return null
|
||||
|
||||
const nonce = process.env.NODE_ENV === 'production' ? headers().get('x-nonce') : ''
|
||||
const nonce = process.env.NODE_ENV === 'production' ? (await headers()).get('x-nonce') : ''
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ export const getLocaleOnServer = async (): Promise<Locale> => {
|
|||
|
||||
if (!languages.length) {
|
||||
// Negotiator expects plain object so we need to transform headers
|
||||
const negotiatorHeaders: Record<string, string> = {}
|
||||
headers().forEach((value, key) => (negotiatorHeaders[key] = value))
|
||||
const negotiatorHeaders: Record<string, string> = {};
|
||||
(await headers()).forEach((value, key) => (negotiatorHeaders[key] = value))
|
||||
// Use negotiator and intl-localematcher to get best locale
|
||||
languages = new Negotiator({ headers: negotiatorHeaders }).languages()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue