feat : remove log in IB

This commit is contained in:
2025-10-17 12:11:44 +05:30
parent ad19f0cb4c
commit 6acb7ade49
5 changed files with 52 additions and 24 deletions

View File

@@ -15,7 +15,7 @@ const nextConfig = {
source: '/api/:path*',
destination: isWindows
? "http://localhost:8080/api/:path*" // For Windows
: "https://kccbmbnk.net/api/:path*", // For Linux/Mac/Server
: "http://localhost:8080/api/:path*", // For Linux/Mac/Server
},
];
},

View File

@@ -30,6 +30,7 @@ export default function Home() {
const selectedLNData = loanAccounts.find(acc => acc.stAccountNo === selectedLN);
const [showBalance, setShowBalance] = useState(false);
const PassExpiryRemains = (dayjs(localStorage.getItem("pswExpiryDate"))).diff(dayjs(), "day")
const [loadingAccountNo, setLoadingAccountNo] = useState<string | null>(null);
// If back and forward button is clicked
useEffect(() => {
@@ -93,7 +94,13 @@ export default function Home() {
}
async function handleGetAccountStatement(accountNo: string) {
router.push(`/accounts/account_statement?accNo=${accountNo}`);
if (loadingAccountNo) return;
setLoadingAccountNo(accountNo);
// simulate loading delay
setTimeout(() => {
router.push(`/accounts/account_statement?accNo=${accountNo}`);
setLoadingAccountNo(null);
}, 5000);
}
useEffect(() => {
@@ -116,7 +123,7 @@ export default function Home() {
return (
<Providers>
<Box p={isMobile ? "8px" : "10px"}>
<Title order={4} style={{fontSize: isMobile ? "18px" : "22px" }}>
<Title order={4} style={{ fontSize: isMobile ? "18px" : "22px" }}>
Accounts Overview
</Title>
@@ -202,8 +209,12 @@ export default function Home() {
? `${Number(selectedDAData?.stAvailableBalance || 0).toLocaleString("en-IN")}`
: "****"}
</Title>
<Button fullWidth mt="xs" onClick={() => handleGetAccountStatement(selectedDA)}>
Get Statement
<Button fullWidth mt="xs"
// loading={loadingAccountNo === selectedDA}
disabled={loadingAccountNo === selectedDA}
onClick={() => handleGetAccountStatement(selectedDA)}
>
{loadingAccountNo === selectedDA ? "Loading...Please Wait" : "Get Statement"}
</Button>
</>
) : (
@@ -271,8 +282,13 @@ export default function Home() {
? `${Number(selectedLNData?.stAvailableBalance || 0).toLocaleString("en-IN")}`
: "****"}
</Title>
<Button fullWidth mt="xs" onClick={() => handleGetAccountStatement(selectedLN)}>
Get Statement
<Button fullWidth mt="xs"
// loading={loadingAccountNo === selectedLN}
disabled={loadingAccountNo === selectedLN}
onClick={() => handleGetAccountStatement(selectedLN)}
>
{/* Get Statement */}
{loadingAccountNo === selectedLN ? "Loading...Please Wait" : "Get Statement"}
</Button>
</>
) : (
@@ -356,8 +372,12 @@ export default function Home() {
<Title order={2} mt="md">
{showBalance ? `${Number(selectedDAData?.stAvailableBalance || 0).toLocaleString("en-IN")}` : "****"}
</Title>
<Button fullWidth mt="xs" onClick={() => handleGetAccountStatement(selectedDA)}>
Get Statement
<Button fullWidth mt="xs"
// loading={loadingAccountNo === selectedDA}
disabled={loadingAccountNo === selectedDA}
onClick={() => handleGetAccountStatement(selectedDA)}
>
{loadingAccountNo === selectedDA ? "Loading... Please Wait" : "Get Statement"}
</Button>
</>
) : (
@@ -409,8 +429,13 @@ export default function Home() {
<Title order={2} mt="md">
{showBalance ? `${Number(selectedLNData?.stAvailableBalance || 0).toLocaleString("en-IN")}` : "****"}
</Title>
<Button fullWidth mt="xs" onClick={() => handleGetAccountStatement(selectedLN)}>
Get Statement
<Button fullWidth mt="xs"
// loading={loadingAccountNo === selectedLN}
disabled={loadingAccountNo === selectedLN}
onClick={() => handleGetAccountStatement(selectedLN)}
>
{/* Get Statement */}
{loadingAccountNo === selectedLN ? "Loading...Please Wait.." : "Get Statement"}
</Button>
</>
) : (

View File

@@ -1,10 +1,10 @@
export function generateOTP(length: number) {
const digits = '0123456789';
let otp = '';
otp += digits[Math.floor(Math.random() * 9)+1]; //first digit cannot be zero
for (let i = 1; i < length; i++) {
otp += digits[Math.floor(Math.random() * digits.length)];
}
// console.log("OTP generate :",otp);
return otp;
}
// export function generateOTP(length: number) {
// const digits = '0123456789';
// let otp = '';
// otp += digits[Math.floor(Math.random() * 9)+1]; //first digit cannot be zero
// for (let i = 1; i < length; i++) {
// otp += digits[Math.floor(Math.random() * digits.length)];
// }
// // console.log("OTP generate :",otp);
// return otp;
// }

View File

@@ -37,6 +37,7 @@ export async function sendOtp(payload: SendOtpPayload) {
{ ...payload, mobileNumber },
{ headers: { 'Content-Type': 'application/json' } }
);
console.log('otp sended.');
return response.data;
} catch (error: any) {
console.error('Error sending OTP:', error.response?.data || error.message);
@@ -52,6 +53,7 @@ export async function verifyOtp(otp: string) {
{ otp },
{ headers: { 'Content-Type': 'application/json' } }
);
console.log('Otp verified');
return response.data;
} catch (error: any) {
console.error('Error verifying OTP:', error.response?.data || error.message);
@@ -67,6 +69,7 @@ export async function verifyLoginOtp(otp: string, mobileNumber: string) {
{ otp },
{ headers: { 'Content-Type': 'application/json' } }
);
console.log('Otp verified.');
return response.data;
} catch (error: any) {
console.error('Error verifying OTP:', error.response?.data || error.message);

View File

@@ -35,7 +35,7 @@ export default function Login() {
const [mobile, setMobile] = useState("");
async function handleSendOtp(mobile?: string) {
console.log("hi mobile", mobile);
// console.log("hi mobile", mobile);
if (!mobile) {
notifications.show({
title: 'Error',
@@ -45,7 +45,7 @@ export default function Login() {
return false;
}
try {
console.log(CIF);
// console.log(CIF);
await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: mobile });
// await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: '7890544527' });
notifications.show({
@@ -186,7 +186,7 @@ export default function Login() {
});
const data = await response.json();
console.log(data);
// console.log(data);
// 1⃣ OTP Required
if (data.status === "OTP_REQUIRED" && response.status === 202) {