From b8019eb4c05048152e7fe0ef29004273cb6d2c50 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sat, 6 Jan 2024 14:03:30 +0330 Subject: [PATCH 1/2] fixed fucking bug --- src/core/utils/globalServerProps.js | 5 +++-- src/middlewares/Deadline.jsx | 4 ++-- src/pages/dashboard/navgan/add-request-loan/index.jsx | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/utils/globalServerProps.js b/src/core/utils/globalServerProps.js index dffb0f2..107efee 100644 --- a/src/core/utils/globalServerProps.js +++ b/src/core/utils/globalServerProps.js @@ -3,13 +3,14 @@ import process from "next/dist/build/webpack/loaders/resolve-url-loader/lib/post export const globalServerProps = async ({req, locale}) => { const {isBot} = parse(req.headers["user-agent"]); - - const responseConfig = await fetch(process.env.NEXT_PUBLIC_CONFIG_APP_URL); + + 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() } } \ No newline at end of file diff --git a/src/middlewares/Deadline.jsx b/src/middlewares/Deadline.jsx index 796ee54..bce5db3 100644 --- a/src/middlewares/Deadline.jsx +++ b/src/middlewares/Deadline.jsx @@ -3,7 +3,7 @@ import moment from "jalali-moment"; import SvgMaintenance from "@/core/components/svgs/SvgMaintenance"; import {Typography} from "@mui/material"; -const DeadlineMiddleware = ({children, type = '', withMessage = false}) => { +const DeadlineMiddleware = ({children, type = '', withMessage = false, serverToday}) => { const {config} = useConfig() const middleware = config.deadlines[type] @@ -11,7 +11,7 @@ const DeadlineMiddleware = ({children, type = '', withMessage = false}) => { const fromDate = moment(middleware.date.from, 'jYYYY/jMM/jDD') const toDate = moment(middleware.date.to, 'jYYYY/jMM/jDD') - const today = moment() + const today = moment(serverToday) if (today.isBetween(fromDate, toDate, null, '[]')) { return children diff --git a/src/pages/dashboard/navgan/add-request-loan/index.jsx b/src/pages/dashboard/navgan/add-request-loan/index.jsx index eedec87..33076eb 100644 --- a/src/pages/dashboard/navgan/add-request-loan/index.jsx +++ b/src/pages/dashboard/navgan/add-request-loan/index.jsx @@ -2,8 +2,8 @@ import LoanRequestComponent from "@/components/dashboard/navgan/add-request-loan import {globalServerProps} from "@/core/utils/globalServerProps"; import DeadlineMiddleware from "@/middlewares/Deadline"; -export default function AddLoanRequest() { - return ( +export default function AddLoanRequest(props) { + return ( ); } From c24db99b9a801a08c5cf268c730cc41907a5d80b Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sat, 6 Jan 2024 14:04:22 +0330 Subject: [PATCH 2/2] change version --- example.env.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.env.local b/example.env.local index 9ec9ec4..cb040cb 100644 --- a/example.env.local +++ b/example.env.local @@ -1,5 +1,5 @@ NEXT_PUBLIC_API_NAME = "Loan Facilities Dashboard" -NEXT_PUBLIC_API_VERSION = "1.26.14" +NEXT_PUBLIC_API_VERSION = "1.26.16" NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa" NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"