Files
user-front/src/core/utils/globalServerProps.js
AmirHossein Mahmoodi b8019eb4c0 fixed fucking bug
2024-01-06 14:03:30 +03:30

16 lines
555 B
JavaScript

import {parse} from "next-useragent";
import process from "next/dist/build/webpack/loaders/resolve-url-loader/lib/postcss";
export const globalServerProps = async ({req, locale}) => {
const {isBot} = parse(req.headers["user-agent"]);
const responseConfig = await fetch(`${process.env.NEXT_PUBLIC_CONFIG_APP_URL}?_=${Math.random()}`);
return {
config: await responseConfig.json(),
messages: (await import(`&/locales/${locale}/app.json`)).default,
isBot,
locale,
today: new Date().getTime()
}
}