fix bank-card validation bug
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "no-copy-frontend",
|
"name": "no-copy-frontend",
|
||||||
"version": "0.68.0",
|
"version": "0.69.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 2999",
|
"dev": "next dev -p 2999",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { bankCardFormSchema } from '@/app/actions/definitions';
|
|||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
|
|
||||||
interface cardInfoType {
|
interface cardInfoType {
|
||||||
cardType: string,
|
cardType: string | null,
|
||||||
potentiallyValid: boolean,
|
potentiallyValid: boolean,
|
||||||
cardValid?: boolean
|
cardValid?: boolean
|
||||||
}
|
}
|
||||||
@@ -110,15 +110,23 @@ export default function BankCard() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.target.value.length === 19 && !numberValidation.isValid) {
|
if (e.target.value.length === 19 && !numberValidation.isValid) {
|
||||||
setCardInfo((prev) => {
|
if (cardInfo) {
|
||||||
if (prev) {
|
setCardInfo((prev) => {
|
||||||
return {
|
if (prev) {
|
||||||
...prev,
|
return {
|
||||||
cardValid: false
|
...prev,
|
||||||
|
cardValid: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return null;
|
||||||
return null;
|
});
|
||||||
})
|
} else {
|
||||||
|
setCardInfo({
|
||||||
|
cardType: null,
|
||||||
|
potentiallyValid: false,
|
||||||
|
cardValid: false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validatedField.success) {
|
if (validatedField.success) {
|
||||||
@@ -162,7 +170,7 @@ export default function BankCard() {
|
|||||||
disabled={!isEditing}
|
disabled={!isEditing}
|
||||||
isValid={cardInfo?.cardValid}
|
isValid={cardInfo?.cardValid}
|
||||||
/>
|
/>
|
||||||
{/* */}
|
|
||||||
{cardInfo && (
|
{cardInfo && (
|
||||||
<div
|
<div
|
||||||
className="card-type"
|
className="card-type"
|
||||||
@@ -173,6 +181,7 @@ export default function BankCard() {
|
|||||||
</div>
|
</div>
|
||||||
{cardInfo?.cardValid === false && (
|
{cardInfo?.cardValid === false && (
|
||||||
<p className="text-sm text-red-500">
|
<p className="text-sm text-red-500">
|
||||||
|
{/* */}
|
||||||
<span>
|
<span>
|
||||||
{t('bank-card-not-valid')}
|
{t('bank-card-not-valid')}
|
||||||
</span>
|
</span>
|
||||||
@@ -248,7 +257,7 @@ export default function BankCard() {
|
|||||||
setIsEditing(true)
|
setIsEditing(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Изменить
|
{t('change')}
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,7 +366,8 @@
|
|||||||
"search-title-description": "Upload a file to search for similar protected content in your library and on the web",
|
"search-title-description": "Upload a file to search for similar protected content in your library and on the web",
|
||||||
"how-does-search-work": "How does search work?",
|
"how-does-search-work": "How does search work?",
|
||||||
"search-info-description-text": "Our system analyzes the uploaded file and compares it with your protected files, using computer vision and digital fingerprinting algorithms.",
|
"search-info-description-text": "Our system analyzes the uploaded file and compares it with your protected files, using computer vision and digital fingerprinting algorithms.",
|
||||||
"documents-few": "Documents"
|
"documents-few": "Documents",
|
||||||
|
"change": "Change"
|
||||||
},
|
},
|
||||||
"Login-register-form": {
|
"Login-register-form": {
|
||||||
"and": "and",
|
"and": "and",
|
||||||
|
|||||||
@@ -366,7 +366,8 @@
|
|||||||
"search-title-description": "Загрузите файл для поиска похожего защищенного контента в вашей библиотеке и в интернете",
|
"search-title-description": "Загрузите файл для поиска похожего защищенного контента в вашей библиотеке и в интернете",
|
||||||
"how-does-search-work": "Как работает поиск?",
|
"how-does-search-work": "Как работает поиск?",
|
||||||
"search-info-description-text": "Наша система анализирует загруженный файл и сравнивает его с вашими защищенными файлами, используя алгоритмы компьютерного зрения и цифровых отпечатков.",
|
"search-info-description-text": "Наша система анализирует загруженный файл и сравнивает его с вашими защищенными файлами, используя алгоритмы компьютерного зрения и цифровых отпечатков.",
|
||||||
"documents-few": "Документов"
|
"documents-few": "Документов",
|
||||||
|
"change": "Изменить"
|
||||||
},
|
},
|
||||||
"Login-register-form": {
|
"Login-register-form": {
|
||||||
"and": "и",
|
"and": "и",
|
||||||
|
|||||||
Reference in New Issue
Block a user