add back build time
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import { getSessionData, deleteSession } from '@/app/actions/session';
|
import { getSessionData, deleteSession } from '@/app/actions/session';
|
||||||
import { testUserData, API_BASE_URL } from '@/app/actions/definitions';
|
import { testUserData, API_BASE_URL } from '@/app/actions/definitions';
|
||||||
import { redirect } from 'next/navigation';
|
|
||||||
|
|
||||||
export async function getUserData() {
|
export async function getUserData() {
|
||||||
const userEmail = await getSessionData('email');
|
const userEmail = await getSessionData('email');
|
||||||
@@ -100,3 +99,22 @@ export async function fetchTariffs() {
|
|||||||
console.error('error');
|
console.error('error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getBuildData() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${API_BASE_URL}/check/api/build`, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
return await response.json();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { QueryClient } from '@tanstack/react-query';
|
import { QueryClient } from '@tanstack/react-query';
|
||||||
import { getUserData, getUserFilesInfo } from '@/app/actions/action';
|
import { getUserData, getUserFilesInfo, getBuildData } from '@/app/actions/action';
|
||||||
import { getUserFilesData } from '@/app/actions/fileEntity';
|
import { getUserFilesData } from '@/app/actions/fileEntity';
|
||||||
import { fetchReferralUserStats } from '@/app/actions/referralsActions';
|
import { fetchReferralUserStats } from '@/app/actions/referralsActions';
|
||||||
|
|
||||||
@@ -24,5 +24,19 @@ export async function prefetchLayoutQueries(queryClient: QueryClient) {
|
|||||||
queryKey: ['referralUserStats'],
|
queryKey: ['referralUserStats'],
|
||||||
queryFn: () => fetchReferralUserStats()
|
queryFn: () => fetchReferralUserStats()
|
||||||
}),
|
}),
|
||||||
|
queryClient.prefetchQuery({
|
||||||
|
queryKey: ['backendBuildDate'],
|
||||||
|
queryFn: async () => {
|
||||||
|
try {
|
||||||
|
const response = await getBuildData();
|
||||||
|
if (response.buildTimeBack) {
|
||||||
|
return response.buildTimeBack;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (error) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@ import { useClickOutside } from '@/app/hooks/useClickOutside';
|
|||||||
import { fetchReferralUserStats } from '@/app/actions/referralsActions';
|
import { fetchReferralUserStats } from '@/app/actions/referralsActions';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { env } from 'process';
|
import { env } from 'process';
|
||||||
|
import { getBuildData } from '@/app/actions/action';
|
||||||
|
|
||||||
export default function NavLinks() {
|
export default function NavLinks() {
|
||||||
const {
|
const {
|
||||||
@@ -56,7 +57,21 @@ export default function NavLinks() {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
retry: false // Не повторять запрос при ошибке
|
retry: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: backendBuildDate,
|
||||||
|
} = useQuery({
|
||||||
|
queryKey: ['backendBuildDate'],
|
||||||
|
queryFn: () => getBuildData(),
|
||||||
|
select: (data) => {
|
||||||
|
if (data) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
retry: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const pathname = usePathname().replace('/en/', '/').replace('/ru/', '/');
|
const pathname = usePathname().replace('/en/', '/').replace('/ru/', '/');
|
||||||
@@ -160,14 +175,16 @@ export default function NavLinks() {
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div className="build-versions">
|
<div className="build-versions">
|
||||||
{!frontendBuildDate && (
|
{frontendBuildDate && (
|
||||||
<div className="">
|
<div className="">
|
||||||
front: {frontendBuildDate}
|
front: {frontendBuildDate}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{/* <div>
|
{backendBuildDate && (
|
||||||
back:
|
<div className="">
|
||||||
</div> */}
|
back: {backendBuildDate}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user