api changed
This commit is contained in:
parent
6cb293ae81
commit
668d471fb2
|
|
@ -126,14 +126,11 @@ const AcceptStage = ({
|
|||
const sendData = async (requestBody) => {
|
||||
try {
|
||||
const headers = { Accept: 'application/json', Authorization: `Bearer ${userToken}` };
|
||||
const response = await fetch(
|
||||
'https://shahsyotag.halkbank.gov.tm/onlineloancre-services/api/quick_loans',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: JSON.stringify(requestBody),
|
||||
},
|
||||
);
|
||||
const response = await fetch('https://shahsyotag.halkbank.gov.tm/app/api/quick_loans', {
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: JSON.stringify(requestBody),
|
||||
});
|
||||
|
||||
const jsonedResponse = await response.json();
|
||||
setAcceptedMessage(jsonedResponse.message);
|
||||
|
|
@ -241,7 +238,9 @@ const AcceptStage = ({
|
|||
id="code"
|
||||
placeholder="6435980023168745"
|
||||
/>
|
||||
<span className="another-option">Оформить карту</span>
|
||||
<span className="another-option" onClick={() => setStage(12)}>
|
||||
Оформить карту
|
||||
</span>
|
||||
{/* {errors.code && <span>{errors.code.message}</span>} */}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,124 @@
|
|||
// IMPORT MODULES
|
||||
import React, { useState, useContext } from 'react';
|
||||
import { LanguageContext } from '../../backend/LanguageContext';
|
||||
import { UserContext } from '../../backend/UserContext';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { z } from 'zod';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
// IMPORT IMAGES
|
||||
import next from '../../icons/next.svg';
|
||||
import next_reverse from '../../icons/next-reverse.svg';
|
||||
|
||||
const CardRegistration = () => {
|
||||
const { locale } = useContext(LanguageContext);
|
||||
const userToken = localStorage.getItem('userToken');
|
||||
|
||||
const handleCardDetails = (e) => {
|
||||
setCardDetails(e.target.value);
|
||||
};
|
||||
return (
|
||||
<section className="imm-cs-1">
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<h2 className="cs-2-title">
|
||||
{locale === 'TKM'
|
||||
? 'Karzyň kalkulýatory'
|
||||
: locale === 'РУС'
|
||||
? 'Подтвердите данные'
|
||||
: locale === 'ENG'
|
||||
? 'Loan calculator'
|
||||
: 'Karzyň kalkulýatory'}
|
||||
</h2>
|
||||
<div className="imm-credit-form-wrapper">
|
||||
<div className="input-block">
|
||||
<label htmlFor="amount">
|
||||
{locale === 'TKM'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Сумма'
|
||||
: locale === 'ENG'
|
||||
? 'amount'
|
||||
: 'At'}
|
||||
</label>
|
||||
<input {...register('amount')} type="text" id="amount" disabled />
|
||||
{errors.amount && <span>{errors.amount.message}</span>}
|
||||
</div>
|
||||
<div className="input-block">
|
||||
<label htmlFor="surname">
|
||||
{locale === 'TKM'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Срок'
|
||||
: locale === 'ENG'
|
||||
? 'duration'
|
||||
: 'At'}
|
||||
</label>
|
||||
<input {...register('duration')} type="text" id="duration" disabled />
|
||||
{errors.duration && <span>{errors.duration.message}</span>}
|
||||
</div>
|
||||
<div className="input-block">
|
||||
<label htmlFor="code">
|
||||
{locale === 'TKM'
|
||||
? 'At'
|
||||
: locale === 'РУС'
|
||||
? 'Номер карты'
|
||||
: locale === 'ENG'
|
||||
? 'amount'
|
||||
: 'At'}
|
||||
</label>
|
||||
<input
|
||||
value={cardDetails}
|
||||
onChange={handleCardDetails}
|
||||
type="text"
|
||||
id="code"
|
||||
placeholder="6435980023168745"
|
||||
/>
|
||||
<span className="another-option" onClick={() => setStage(12)}>
|
||||
Оформить карту
|
||||
</span>
|
||||
{/* {errors.code && <span>{errors.code.message}</span>} */}
|
||||
</div>
|
||||
</div>
|
||||
<div className="cu-bottom cd-2-title">
|
||||
<button type="button" className="sign-btn reg-btn" onClick={() => setStage(7)}>
|
||||
<div>
|
||||
<div className="btn-img">
|
||||
<img src={next_reverse} alt="logout" />
|
||||
</div>
|
||||
<h3>
|
||||
{locale === 'TKM'
|
||||
? 'Yza'
|
||||
: locale === 'РУС'
|
||||
? 'Назад'
|
||||
: locale === 'ENG'
|
||||
? 'Back'
|
||||
: 'Yza'}
|
||||
</h3>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="sign-btn cu-btn"
|
||||
disabled={cardDetails.length !== 23 && !isLoading ? true : false}
|
||||
onClick={onSubmit}>
|
||||
<div>
|
||||
<h3>
|
||||
{locale === 'TKM'
|
||||
? 'Dowam et'
|
||||
: locale === 'РУС'
|
||||
? 'Подтвердить '
|
||||
: locale === 'ENG'
|
||||
? 'Proceed'
|
||||
: 'Dowam et'}
|
||||
</h3>
|
||||
<div className="btn-img">
|
||||
<img src={next} alt="logout" />
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default CardRegistration;
|
||||
|
|
@ -353,6 +353,13 @@ const ImmediateCreditModal = ({
|
|||
stage={stage}
|
||||
message={acceptedMessage}
|
||||
/>
|
||||
) : stage === 12 ? (
|
||||
<LoanAccepted
|
||||
setModalOpen={setModalOpen}
|
||||
setStage={setStage}
|
||||
stage={stage}
|
||||
message={acceptedMessage}
|
||||
/>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
|
|
|
|||
Loading…
Reference in New Issue