From 719b03c7322302070b6f595df02a4775585df687 Mon Sep 17 00:00:00 2001 From: VividTruthKeeper Date: Mon, 11 Apr 2022 23:11:39 +0500 Subject: [PATCH] minor changes --- src/backend/sendRequestCard.js | 14 +--- src/components/CardStages/CardStage2.js | 87 ++++----------------- src/components/CardStages/CardStage6.js | 24 +----- src/components/CreditStages/CreditStage1.js | 2 +- src/components/CreditStages/CreditStage3.js | 87 ++++----------------- src/components/global/LoggedNav.js | 8 ++ 6 files changed, 40 insertions(+), 182 deletions(-) diff --git a/src/backend/sendRequestCard.js b/src/backend/sendRequestCard.js index c3519e5..0f95dab 100644 --- a/src/backend/sendRequestCard.js +++ b/src/backend/sendRequestCard.js @@ -1,7 +1,6 @@ import axios from "axios"; -// import { getDate } from "../helpers/Date"; -export const sendRequestCard = (url, token, data, setLoader, setError) => { +export const sendRequestCard = (url, token, data) => { let today = new Date(); let dd = String(today.getDate()).padStart(2, "0"); let mm = String(today.getMonth() + 1).padStart(2, "0"); @@ -34,15 +33,6 @@ export const sendRequestCard = (url, token, data, setLoader, setError) => { .post(`${url}?token=${token}`, form) .then((res) => { window.open(res.data, "_self").focus(); - if (setLoader) { - setLoader(false); - } }) - .catch(() => { - setLoader(false); - setError(true); - setTimeout(() => { - setError(false); - }, 2000); - }); + .catch(() => {}); }; diff --git a/src/components/CardStages/CardStage2.js b/src/components/CardStages/CardStage2.js index 899de45..0ea63f2 100644 --- a/src/components/CardStages/CardStage2.js +++ b/src/components/CardStages/CardStage2.js @@ -4,8 +4,6 @@ import { UserContext } from "../../backend/UserContext"; import { LanguageContext } from "../../backend/LanguageContext"; // IMPORT VALIDATORS -import { ValidateEmail } from "../../validators/ValidateEmail"; -import { ValidatePhoneNumber } from "../../validators/ValidatePhoneNumber"; import { getDate } from "../../helpers/Date"; // IMPORT IMAGES @@ -15,7 +13,10 @@ import next_reverse from "../../icons/next-reverse.svg"; const CardStage2 = ({ setStage, data, setData }) => { const { locale } = useContext(LanguageContext); const { user } = useContext(UserContext); - const [inputValid, setInputValid] = useState({ + const [ + inputValid, + // setInputValid + ] = useState({ surname: data.surname ? data.surname : user ? user.surname : null, name: data.name ? data.name : user ? user.name : null, fathers: data.middlename ? data.middlename : user ? user.middle_name : null, @@ -76,16 +77,10 @@ const CardStage2 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, surname: e.target.value }); - } else { - setInputValid({ ...inputValid, surname: false }); - } - }} />
@@ -94,16 +89,10 @@ const CardStage2 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, name: e.target.value }); - } else { - setInputValid({ ...inputValid, name: false }); - } - }} />
@@ -112,16 +101,10 @@ const CardStage2 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, fathers: e.target.value }); - } else { - setInputValid({ ...inputValid, fathers: false }); - } - }} />
@@ -130,18 +113,12 @@ const CardStage2 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, date: e.target.value }); - } else { - setInputValid({ ...inputValid, date: false }); - } - }} />
@@ -150,16 +127,10 @@ const CardStage2 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, passport: e.target.value }); - } else { - setInputValid({ ...inputValid, passport: false }); - } - }} />
@@ -170,16 +141,10 @@ const CardStage2 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, p_address: e.target.value }); - } else { - setInputValid({ ...inputValid, p_address: false }); - } - }} />
@@ -188,16 +153,10 @@ const CardStage2 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, address: e.target.value }); - } else { - setInputValid({ ...inputValid, address: false }); - } - }} />
@@ -206,16 +165,10 @@ const CardStage2 = ({ setStage, data, setData }) => { * { - if (ValidateEmail(e.target.value)) { - setInputValid({ ...inputValid, mail: e.target.value }); - } else { - setInputValid({ ...inputValid, mail: false }); - } - }} />
@@ -224,16 +177,10 @@ const CardStage2 = ({ setStage, data, setData }) => { * { - if (ValidatePhoneNumber(e.target.value)) { - setInputValid({ ...inputValid, mobile: e.target.value }); - } else { - setInputValid({ ...inputValid, mobile: false }); - } - }} />
@@ -241,16 +188,10 @@ const CardStage2 = ({ setStage, data, setData }) => { {locale === "TUK" ? "Öý telefon" : "Домашний телефон"} { - if (ValidatePhoneNumber(e.target.value)) { - setInputValid({ ...inputValid, home: e.target.value }); - } else { - setInputValid({ ...inputValid, home: false }); - } - }} />
diff --git a/src/components/CardStages/CardStage6.js b/src/components/CardStages/CardStage6.js index 1403d3c..3c8ce3e 100644 --- a/src/components/CardStages/CardStage6.js +++ b/src/components/CardStages/CardStage6.js @@ -71,15 +71,6 @@ const CardStage6 = ({ : data.sms_notification ? "Да" : "Нет"} - {/* {data.sms_notification - ? locale === "RUS" - ? data.sms_notification === true - ? "Да" - : "Нет" - : data.sms_notification === true - ? "Hawa" - : "Ýok" - : "-"} */}
  • @@ -157,20 +148,7 @@ const CardStage6 = ({ onClick={() => { setLoader(true); setModalOpen(false); - sendRequestCard( - postUrl, - token, - data, - () => { - setSuccess(true); - setLoader(false); - setTimeout(() => { - setSuccess(false); - getUserInfo(getUrl, token, setUser, () => null); - }, 2000); - }, - setError - ); + sendRequestCard(postUrl, token, data); }} >
    diff --git a/src/components/CreditStages/CreditStage1.js b/src/components/CreditStages/CreditStage1.js index 3ddcf54..d80e584 100644 --- a/src/components/CreditStages/CreditStage1.js +++ b/src/components/CreditStages/CreditStage1.js @@ -17,7 +17,7 @@ const CreditStage1 = ({ setStage, data, setData, creditData, id, setId }) => { }); const [input, setInput] = useState(data.type ? data.type : null); const [dropdown, setDropdown] = useState({ - one: true, + one: false, two: false, }); const parser = new DOMParser(); diff --git a/src/components/CreditStages/CreditStage3.js b/src/components/CreditStages/CreditStage3.js index 24bc0f7..f023abf 100644 --- a/src/components/CreditStages/CreditStage3.js +++ b/src/components/CreditStages/CreditStage3.js @@ -4,8 +4,6 @@ import { UserContext } from "../../backend/UserContext"; import { LanguageContext } from "../../backend/LanguageContext"; // IMPORT VALIDATORS -import { ValidateEmail } from "../../validators/ValidateEmail"; -import { ValidatePhoneNumber } from "../../validators/ValidatePhoneNumber"; import { getDate } from "../../helpers/Date"; // IMPORT IMAGES @@ -15,7 +13,10 @@ import next_reverse from "../../icons/next-reverse.svg"; const CreditStage3 = ({ setStage, data, setData }) => { const { locale } = useContext(LanguageContext); const { user } = useContext(UserContext); - const [inputValid, setInputValid] = useState({ + const [ + inputValid, + // setInputValid + ] = useState({ surname: data.surname ? data.surname : user ? user.surname : null, name: data.name ? data.name : user ? user.name : null, fathers: data.fathers ? data.fathers : user ? user.middle_name : null, @@ -60,16 +61,10 @@ const CreditStage3 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, surname: e.target.value }); - } else { - setInputValid({ ...inputValid, surname: false }); - } - }} />
    @@ -78,16 +73,10 @@ const CreditStage3 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, name: e.target.value }); - } else { - setInputValid({ ...inputValid, name: false }); - } - }} />
    @@ -96,16 +85,10 @@ const CreditStage3 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, fathers: e.target.value }); - } else { - setInputValid({ ...inputValid, fathers: false }); - } - }} />
    @@ -114,18 +97,12 @@ const CreditStage3 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, date: e.target.value }); - } else { - setInputValid({ ...inputValid, date: false }); - } - }} />
    @@ -134,16 +111,10 @@ const CreditStage3 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, passport: e.target.value }); - } else { - setInputValid({ ...inputValid, passport: false }); - } - }} />
    @@ -154,16 +125,10 @@ const CreditStage3 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, p_address: e.target.value }); - } else { - setInputValid({ ...inputValid, p_address: false }); - } - }} />
    @@ -172,16 +137,10 @@ const CreditStage3 = ({ setStage, data, setData }) => { * { - if (e.target.value !== "") { - setInputValid({ ...inputValid, address: e.target.value }); - } else { - setInputValid({ ...inputValid, address: false }); - } - }} />
    @@ -190,16 +149,10 @@ const CreditStage3 = ({ setStage, data, setData }) => { * { - if (ValidateEmail(e.target.value)) { - setInputValid({ ...inputValid, mail: e.target.value }); - } else { - setInputValid({ ...inputValid, mail: false }); - } - }} />
    @@ -208,16 +161,10 @@ const CreditStage3 = ({ setStage, data, setData }) => { * { - if (ValidatePhoneNumber(e.target.value)) { - setInputValid({ ...inputValid, mobile: e.target.value }); - } else { - setInputValid({ ...inputValid, mobile: false }); - } - }} />
    @@ -225,16 +172,10 @@ const CreditStage3 = ({ setStage, data, setData }) => { {locale === "TUK" ? "Öý telefon" : "Домашний телефон"} { - if (ValidatePhoneNumber(e.target.value)) { - setInputValid({ ...inputValid, home: e.target.value }); - } else { - setInputValid({ ...inputValid, home: false }); - } - }} />
    diff --git a/src/components/global/LoggedNav.js b/src/components/global/LoggedNav.js index b3f179a..dfb4b72 100644 --- a/src/components/global/LoggedNav.js +++ b/src/components/global/LoggedNav.js @@ -125,8 +125,16 @@ const LoggedNav = ({ sideOpen, setSideOpen }) => { : "Данные профиля"}
  • +
  • + + {locale === "TUK" + ? "Açar sözüni çalyşmak" + : "Смена пароля"} + +