diff --git a/next.config.mjs b/next.config.mjs index 76db5ae..dd7ab8a 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -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 }, ]; }, diff --git a/src/app/(main)/home/page.tsx b/src/app/(main)/home/page.tsx index 0ea1c1b..c106382 100644 --- a/src/app/(main)/home/page.tsx +++ b/src/app/(main)/home/page.tsx @@ -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(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 ( - + <Title order={4} style={{ fontSize: isMobile ? "18px" : "22px" }}> Accounts Overview @@ -202,8 +209,12 @@ export default function Home() { ? `₹${Number(selectedDAData?.stAvailableBalance || 0).toLocaleString("en-IN")}` : "****"} - ) : ( @@ -271,8 +282,13 @@ export default function Home() { ? `₹${Number(selectedLNData?.stAvailableBalance || 0).toLocaleString("en-IN")}` : "****"} - ) : ( @@ -356,8 +372,12 @@ export default function Home() { {showBalance ? `₹${Number(selectedDAData?.stAvailableBalance || 0).toLocaleString("en-IN")}` : "****"} - ) : ( @@ -409,8 +429,13 @@ export default function Home() { {showBalance ? `₹${Number(selectedLNData?.stAvailableBalance || 0).toLocaleString("en-IN")}` : "****"} - ) : ( diff --git a/src/app/OTPGenerator.ts b/src/app/OTPGenerator.ts index dc18098..0fff599 100644 --- a/src/app/OTPGenerator.ts +++ b/src/app/OTPGenerator.ts @@ -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; -} \ No newline at end of file +// 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; +// } \ No newline at end of file diff --git a/src/app/_util/otp.ts b/src/app/_util/otp.ts index 6948308..da02eca 100644 --- a/src/app/_util/otp.ts +++ b/src/app/_util/otp.ts @@ -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); diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index 956d4b9..cf4f7bf 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -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) {