add health check

This commit is contained in:
smanylov
2026-02-18 14:21:57 +07:00
parent f4a13e2a8e
commit 906b3a554c
5 changed files with 80 additions and 47 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "no-copy-frontend", "name": "no-copy-frontend",
"version": "0.42.0", "version": "0.43.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev -p 2999", "dev": "next dev -p 2999",
+58 -44
View File
@@ -7,6 +7,8 @@ import LanguageSwitcher from '@/app/components/LanguageSwitcher';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import VKLogin from '@/app/components/VKLogin'; import VKLogin from '@/app/components/VKLogin';
import YandexAuthWithScript from '@/app/components/YandexLogin'; import YandexAuthWithScript from '@/app/components/YandexLogin';
import { getHealt } from '@/app/actions/action';
import { Suspense } from 'react';
export const metadata: Metadata = { export const metadata: Metadata = {
title: 'Login', title: 'Login',
@@ -15,57 +17,69 @@ export const metadata: Metadata = {
export default function Page() { export default function Page() {
const t = useTranslations('Login-register-form'); const t = useTranslations('Login-register-form');
async function HealthData() {
const data = await getHealt();
if (!data) {
return <div>Сервер временно не работает</div>
} else {
return null
}
}
return ( return (
<div className={`${styles['login-container-wrapper']}`}> <Suspense fallback={<div>Loading...</div>}>
{/* <div className={`${styles['login-container-language']}`}> <HealthData />
<div className={`${styles['login-container-wrapper']}`}>
{/* <div className={`${styles['login-container-language']}`}>
<LanguageSwitcher /> <LanguageSwitcher />
</div> */} </div> */}
<div className={`${styles['login-container']}`}> <div className={`${styles['login-container']}`}>
<div className={`${styles['logo']}`}> <div className={`${styles['logo']}`}>
<LogoIcon /> <LogoIcon />
<h1>NO COPY</h1> <h1>NO COPY</h1>
<p> <p>
{t('copyright-protection')} {t('copyright-protection')}
</p> </p>
</div>
<LoginForm />
<div className="divider">
<span>
{t('or-log-in-via')}
</span>
</div>
<div className="mb-4">
<VKLogin />
</div>
<div>
<YandexAuthWithScript />
</div>
<div className={`${styles['register-link']}`}>
<p>{t('no-account')}?
<Link href="register"> {t('register')}</Link>
</p>
</div>
<div className={`${styles['features']}`}>
<div className={`${styles['feature']}`}>
<svg className={`${styles['feature-icon']}`} viewBox="0 0 24 24" fill="currentColor">
<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
{t('protecting-watermark')}
</div> </div>
<div className={`${styles['feature']}`}> <LoginForm />
<svg className={`${styles['feature-icon']}`} viewBox="0 0 24 24" fill="currentColor"> <div className="divider">
<path d="M13 10V3L4 14h7v7l9-11h-7z"></path> <span>
</svg> {t('or-log-in-via')}
{t('monitoring-violations')} </span>
</div> </div>
<div className={`${styles['feature']}`}> <div className="mb-4">
<svg className={`${styles['feature-icon']}`} viewBox="0 0 24 24" fill="currentColor"> <VKLogin />
<path d="M12 1L3 5v6c0 5.55 3.84 9.74 9 11 5.16-1.26 9-5.45 9-11V5l-9-4z"></path> </div>
</svg> <div>
{t('safe-storage')} <YandexAuthWithScript />
</div>
<div className={`${styles['register-link']}`}>
<p>{t('no-account')}?
<Link href="register"> {t('register')}</Link>
</p>
</div>
<div className={`${styles['features']}`}>
<div className={`${styles['feature']}`}>
<svg className={`${styles['feature-icon']}`} viewBox="0 0 24 24" fill="currentColor">
<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
{t('protecting-watermark')}
</div>
<div className={`${styles['feature']}`}>
<svg className={`${styles['feature-icon']}`} viewBox="0 0 24 24" fill="currentColor">
<path d="M13 10V3L4 14h7v7l9-11h-7z"></path>
</svg>
{t('monitoring-violations')}
</div>
<div className={`${styles['feature']}`}>
<svg className={`${styles['feature-icon']}`} viewBox="0 0 24 24" fill="currentColor">
<path d="M12 1L3 5v6c0 5.55 3.84 9.74 9 11 5.16-1.26 9-5.45 9-11V5l-9-4z"></path>
</svg>
{t('safe-storage')}
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </Suspense>
); );
} }
+20
View File
@@ -158,4 +158,24 @@ export async function fetchINN(inn: string) {
} catch (error) { } catch (error) {
return null return null
} }
}
export async function getHealt() {
try {
const response = await fetch(`${API_BASE_URL}/check/api/healt`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
if (response.ok) {
return await response.json();
} else {
return null
}
} catch (error) {
return null
}
} }
+1 -1
View File
@@ -27,7 +27,7 @@ export async function yooKasaCreatePayment(amount: number, tariff: string) {
return_url: 'test' return_url: 'test'
}, },
metadata: { metadata: {
userId: userEmail, userMail: userEmail,
tariff: tariff tariff: tariff
} }
}; };
-1
View File
@@ -19,7 +19,6 @@ export default function LoginForm() {
setShowPassword(!showPassword); setShowPassword(!showPassword);
} }
const checkBoxRememberMe = useRef<HTMLInputElement>(null); const checkBoxRememberMe = useRef<HTMLInputElement>(null);
return ( return (