From 7ba258dc21676f096c8858d013432e9b28a92de8 Mon Sep 17 00:00:00 2001 From: "tomosa.sarkar" Date: Mon, 27 Oct 2025 11:56:36 +0530 Subject: [PATCH] Fix: Add header in every API call. " 'X-Login-Type': 'IB'," --- src/app/(main)/accounts/account_details/page.tsx | 1 + .../accounts/account_statement/accountStatement.tsx | 2 ++ src/app/(main)/accounts/page.tsx | 1 + .../add_beneficiary/addBeneficiaryOthers.tsx | 3 +++ .../(main)/funds_transfer/add_beneficiary/page.tsx | 1 + src/app/(main)/funds_transfer/outside_quick_pay.tsx | 1 + src/app/(main)/funds_transfer/page.tsx | 3 +++ .../(main)/funds_transfer/send_beneficiary/page.tsx | 3 +++ .../send_beneficiary/sendBeneficiaryOthers.tsx | 3 +++ .../(main)/funds_transfer/view_beneficiary/page.tsx | 7 ++++++- src/app/(main)/home/page.tsx | 1 + src/app/(main)/layout.tsx | 1 + .../(main)/settings/change_login_password/page.tsx | 1 + .../(main)/settings/change_txn_password/page.tsx | 1 + src/app/(main)/settings/page.tsx | 1 + src/app/(main)/settings/set_txn_password/page.tsx | 1 + src/app/(main)/settings/user_name/page.tsx | 2 ++ src/app/ChangePassword/page.tsx | 1 + src/app/ForgetPassword/page.tsx | 1 + src/app/SetPassword/page.tsx | 1 + src/app/SetTxn/page.tsx | 1 + src/app/_util/otp.ts | 13 ++++++++----- src/app/_util/userdetails.ts | 1 + src/app/eMandate/mandate_page/page.tsx | 5 ++++- src/app/login/page.tsx | 12 ++++++------ 25 files changed, 55 insertions(+), 13 deletions(-) diff --git a/src/app/(main)/accounts/account_details/page.tsx b/src/app/(main)/accounts/account_details/page.tsx index cfe1ead..e6d84bc 100644 --- a/src/app/(main)/accounts/account_details/page.tsx +++ b/src/app/(main)/accounts/account_details/page.tsx @@ -68,6 +68,7 @@ export default function AccountDetails() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); diff --git a/src/app/(main)/accounts/account_statement/accountStatement.tsx b/src/app/(main)/accounts/account_statement/accountStatement.tsx index ccf1ea2..89e502b 100644 --- a/src/app/(main)/accounts/account_statement/accountStatement.tsx +++ b/src/app/(main)/accounts/account_statement/accountStatement.tsx @@ -43,6 +43,7 @@ export default function AccountStatementPage() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }) @@ -128,6 +129,7 @@ export default function AccountStatementPage() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); diff --git a/src/app/(main)/accounts/page.tsx b/src/app/(main)/accounts/page.tsx index 7024cf5..16ca7bf 100644 --- a/src/app/(main)/accounts/page.tsx +++ b/src/app/(main)/accounts/page.tsx @@ -26,6 +26,7 @@ export default function AccountSummary() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); diff --git a/src/app/(main)/funds_transfer/add_beneficiary/addBeneficiaryOthers.tsx b/src/app/(main)/funds_transfer/add_beneficiary/addBeneficiaryOthers.tsx index 0463ee3..6dae4f2 100644 --- a/src/app/(main)/funds_transfer/add_beneficiary/addBeneficiaryOthers.tsx +++ b/src/app/(main)/funds_transfer/add_beneficiary/addBeneficiaryOthers.tsx @@ -104,6 +104,7 @@ export default function AddBeneficiaryOthers() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, } @@ -189,6 +190,7 @@ export default function AddBeneficiaryOthers() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, } @@ -258,6 +260,7 @@ export default function AddBeneficiaryOthers() { method: "POST", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ diff --git a/src/app/(main)/funds_transfer/add_beneficiary/page.tsx b/src/app/(main)/funds_transfer/add_beneficiary/page.tsx index 68a5a3e..8199128 100644 --- a/src/app/(main)/funds_transfer/add_beneficiary/page.tsx +++ b/src/app/(main)/funds_transfer/add_beneficiary/page.tsx @@ -113,6 +113,7 @@ const AddBeneficiary: React.FC = () => { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); diff --git a/src/app/(main)/funds_transfer/outside_quick_pay.tsx b/src/app/(main)/funds_transfer/outside_quick_pay.tsx index d06be0c..389be2f 100644 --- a/src/app/(main)/funds_transfer/outside_quick_pay.tsx +++ b/src/app/(main)/funds_transfer/outside_quick_pay.tsx @@ -128,6 +128,7 @@ // method: "GET", // headers: { // "Content-Type": "application/json", + // "X-Login-Type": "IB", // Authorization: `Bearer ${token}`, // }, // }); diff --git a/src/app/(main)/funds_transfer/page.tsx b/src/app/(main)/funds_transfer/page.tsx index 2ad2b74..1abb5bb 100644 --- a/src/app/(main)/funds_transfer/page.tsx +++ b/src/app/(main)/funds_transfer/page.tsx @@ -88,6 +88,7 @@ export default function QuickPay() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); @@ -173,6 +174,7 @@ export default function QuickPay() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); @@ -265,6 +267,7 @@ export default function QuickPay() { method: "POST", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ diff --git a/src/app/(main)/funds_transfer/send_beneficiary/page.tsx b/src/app/(main)/funds_transfer/send_beneficiary/page.tsx index 673f525..df7104c 100644 --- a/src/app/(main)/funds_transfer/send_beneficiary/page.tsx +++ b/src/app/(main)/funds_transfer/send_beneficiary/page.tsx @@ -85,6 +85,7 @@ export default function SendToBeneficiaryOwn() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); @@ -115,6 +116,7 @@ export default function SendToBeneficiaryOwn() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); @@ -263,6 +265,7 @@ export default function SendToBeneficiaryOwn() { method: "POST", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ diff --git a/src/app/(main)/funds_transfer/send_beneficiary/sendBeneficiaryOthers.tsx b/src/app/(main)/funds_transfer/send_beneficiary/sendBeneficiaryOthers.tsx index 3088e72..b425ac0 100644 --- a/src/app/(main)/funds_transfer/send_beneficiary/sendBeneficiaryOthers.tsx +++ b/src/app/(main)/funds_transfer/send_beneficiary/sendBeneficiaryOthers.tsx @@ -114,6 +114,7 @@ export default function SendToBeneficiaryOthers() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); @@ -172,6 +173,7 @@ export default function SendToBeneficiaryOthers() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); @@ -309,6 +311,7 @@ export default function SendToBeneficiaryOthers() { method: "POST", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ diff --git a/src/app/(main)/funds_transfer/view_beneficiary/page.tsx b/src/app/(main)/funds_transfer/view_beneficiary/page.tsx index 7b53a26..2eaa4ea 100644 --- a/src/app/(main)/funds_transfer/view_beneficiary/page.tsx +++ b/src/app/(main)/funds_transfer/view_beneficiary/page.tsx @@ -114,7 +114,11 @@ export default function ViewBeneficiary() { const token = localStorage.getItem("access_token"); const res = await fetch(`/api/beneficiary/${selectedAccount}`, { method: "DELETE", - headers: { Authorization: `Bearer ${token}` }, + headers: { + "Content-Type": "application/json", + "X-Login-Type": "IB", + Authorization: `Bearer ${token}` + }, }); if (res.ok) { @@ -161,6 +165,7 @@ export default function ViewBeneficiary() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); diff --git a/src/app/(main)/home/page.tsx b/src/app/(main)/home/page.tsx index 7bcb59d..92aef9a 100644 --- a/src/app/(main)/home/page.tsx +++ b/src/app/(main)/home/page.tsx @@ -66,6 +66,7 @@ export default function Home() { method: 'GET', headers: { 'Content-Type': 'application/json', + "X-Login-Type": "IB", 'Authorization': `Bearer ${token}` }, }); diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 99305e5..ad2df94 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -83,6 +83,7 @@ export default function RootLayout({ children }: { children: React.ReactNode }) method: 'GET', headers: { 'Content-Type': 'application/json', + "X-Login-Type": "IB", 'Authorization': `Bearer ${token}` }, }); diff --git a/src/app/(main)/settings/change_login_password/page.tsx b/src/app/(main)/settings/change_login_password/page.tsx index 7cc4aa7..8202a0b 100644 --- a/src/app/(main)/settings/change_login_password/page.tsx +++ b/src/app/(main)/settings/change_login_password/page.tsx @@ -175,6 +175,7 @@ export default function ChangePassword() { method: "POST", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ diff --git a/src/app/(main)/settings/change_txn_password/page.tsx b/src/app/(main)/settings/change_txn_password/page.tsx index 66e478a..f9e6617 100644 --- a/src/app/(main)/settings/change_txn_password/page.tsx +++ b/src/app/(main)/settings/change_txn_password/page.tsx @@ -183,6 +183,7 @@ export default function ChangePassword() { method: "POST", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ diff --git a/src/app/(main)/settings/page.tsx b/src/app/(main)/settings/page.tsx index d70d0d2..b69377e 100644 --- a/src/app/(main)/settings/page.tsx +++ b/src/app/(main)/settings/page.tsx @@ -40,6 +40,7 @@ export default function ViewProfile() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); diff --git a/src/app/(main)/settings/set_txn_password/page.tsx b/src/app/(main)/settings/set_txn_password/page.tsx index 6b563b1..5e3262a 100644 --- a/src/app/(main)/settings/set_txn_password/page.tsx +++ b/src/app/(main)/settings/set_txn_password/page.tsx @@ -190,6 +190,7 @@ export default function ChangePassword() { method: "POST", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ diff --git a/src/app/(main)/settings/user_name/page.tsx b/src/app/(main)/settings/user_name/page.tsx index f4cac0d..d8820ea 100644 --- a/src/app/(main)/settings/user_name/page.tsx +++ b/src/app/(main)/settings/user_name/page.tsx @@ -63,6 +63,7 @@ export default function SetPreferredNameSimple() { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, }); @@ -167,6 +168,7 @@ export default function SetPreferredNameSimple() { method: "POST", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ user_name: preferredName }), diff --git a/src/app/ChangePassword/page.tsx b/src/app/ChangePassword/page.tsx index 73a748f..da545bb 100644 --- a/src/app/ChangePassword/page.tsx +++ b/src/app/ChangePassword/page.tsx @@ -199,6 +199,7 @@ export default function ChangePassword() { method: "POST", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", Authorization: `Bearer ${token}`, }, body: JSON.stringify({ diff --git a/src/app/ForgetPassword/page.tsx b/src/app/ForgetPassword/page.tsx index a77dbab..8d52422 100644 --- a/src/app/ForgetPassword/page.tsx +++ b/src/app/ForgetPassword/page.tsx @@ -90,6 +90,7 @@ export default function ForgetLoginPwd() { method: 'POST', headers: { 'Content-Type': 'application/json', + 'X-Login-Type': 'IB', 'Authorization': `Bearer ${token}` }, body: JSON.stringify({ diff --git a/src/app/SetPassword/page.tsx b/src/app/SetPassword/page.tsx index c009044..9a83d68 100644 --- a/src/app/SetPassword/page.tsx +++ b/src/app/SetPassword/page.tsx @@ -173,6 +173,7 @@ export default function SetLoginPwd() { method: 'POST', headers: { 'Content-Type': 'application/json', + 'X-Login-Type': 'IB', 'Authorization': `Bearer ${token}` }, body: JSON.stringify({ diff --git a/src/app/SetTxn/page.tsx b/src/app/SetTxn/page.tsx index 52f0512..2226d02 100644 --- a/src/app/SetTxn/page.tsx +++ b/src/app/SetTxn/page.tsx @@ -212,6 +212,7 @@ export default function SetTransactionPwd() { method: 'POST', headers: { 'Content-Type': 'application/json', + 'X-Login-Type': 'IB', 'Authorization': `Bearer ${token}` }, body: JSON.stringify({ diff --git a/src/app/_util/otp.ts b/src/app/_util/otp.ts index ee61e80..0e1fc67 100644 --- a/src/app/_util/otp.ts +++ b/src/app/_util/otp.ts @@ -14,8 +14,8 @@ interface SendOtpPayload { } function getStoredMobileNumber(): string { - const mobileNumber = localStorage.getItem('remitter_mobile_no'); - // const mobileNumber = "7890544527"; + // const mobileNumber = localStorage.getItem('remitter_mobile_no'); + const mobileNumber = "7890544527"; if (!mobileNumber) throw new Error('Mobile number not found.'); return mobileNumber; } @@ -25,7 +25,10 @@ export async function sendOtp(payload: SendOtpPayload) { const response = await fetch('/api/otp/send', { method: "POST", - headers: { "Content-Type": "application/json" }, + headers: { + "Content-Type": "application/json", + "X-Login-Type": "IB", + }, body: JSON.stringify({ ...payload, mobileNumber }), }); @@ -45,7 +48,7 @@ export async function verifyOtp(otp: string) { const response = await fetch(`/api/otp/verify?mobileNumber=${mobileNumber}`, { method: "POST", - headers: { "Content-Type": "application/json" }, + headers: { "Content-Type": "application/json", "X-Login-Type": "IB" }, body: JSON.stringify({ otp }), }); @@ -63,7 +66,7 @@ export async function verifyOtp(otp: string) { export async function verifyLoginOtp(otp: string, mobileNumber: string) { const response = await fetch(`/api/otp/verify?mobileNumber=${mobileNumber}`, { method: "POST", - headers: { "Content-Type": "application/json" }, + headers: { "Content-Type": "application/json", "X-Login-Type": "IB", }, body: JSON.stringify({ otp }), }); diff --git a/src/app/_util/userdetails.ts b/src/app/_util/userdetails.ts index 6e0272b..5f86ae7 100644 --- a/src/app/_util/userdetails.ts +++ b/src/app/_util/userdetails.ts @@ -8,6 +8,7 @@ export async function fetchAndStoreUserName(token: string) { method: "GET", headers: { "Content-Type": "application/json", + "X-Login-Type": "IB", "Authorization": `Bearer ${token}`, }, }); diff --git a/src/app/eMandate/mandate_page/page.tsx b/src/app/eMandate/mandate_page/page.tsx index ec30b2c..4d6e6be 100644 --- a/src/app/eMandate/mandate_page/page.tsx +++ b/src/app/eMandate/mandate_page/page.tsx @@ -127,6 +127,7 @@ export default function MandatePage() { method: "GET", headers: { "Content-Type": "application/json", + 'X-Login-Type': 'emandate', Authorization: `Bearer ${token}`, }, }); @@ -181,6 +182,7 @@ export default function MandatePage() { method: "POST", headers: { "Content-Type": "application/json", + 'X-Login-Type': 'emandate', }, body: JSON.stringify({ mobileNumber: localStorage.getItem("userMobNo"), @@ -218,7 +220,7 @@ export default function MandatePage() { try { const response = await fetch("/api/otp/send", { method: "POST", - headers: { "Content-Type": "application/json" }, + headers: { "Content-Type": "application/json",'X-Login-Type': 'emandate' }, body: JSON.stringify({ mobileNumber: localStorage.getItem("userMobNo"), type: "EMandate", @@ -262,6 +264,7 @@ export default function MandatePage() { method: "POST", headers: { "Content-Type": "application/json", + 'X-Login-Type': 'emandate', }, body: JSON.stringify({ otp: otp, diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index b23a034..8916ba7 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -45,8 +45,8 @@ export default function Login() { } try { - await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: mobile }); - // await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: "7890544527" }); + // await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: mobile }); + await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: "7890544527" }); notifications.show({ color: 'orange', title: 'OTP Required', @@ -67,8 +67,8 @@ export default function Login() { async function handleVerifyOtp(mobile?: string) { try { if (mobile) { - await verifyLoginOtp(otp, mobile); - // await verifyLoginOtp(otp, '7890544527'); + // await verifyLoginOtp(otp, mobile); + await verifyLoginOtp(otp, '7890544527'); return true; } } @@ -308,7 +308,7 @@ export default function Login() { setLoading(true); const res = await fetch(`/api/otp/send/set-password?customerNo=${CIF}`, { method: "GET", - headers: { "Content-Type": "application/json" }, + headers: { "Content-Type": "application/json", 'X-Login-Type': 'IB', }, }); if (!res.ok) throw new Error("Failed to send OTP"); @@ -344,7 +344,7 @@ export default function Login() { setLoading(true); const res = await fetch(`/api/otp/verify/set-password?customerNo=${CIF}&otp=${otp}`, { method: "GET", - headers: { "Content-Type": "application/json" }, + headers: { "Content-Type": "application/json", 'X-Login-Type': 'IB', }, }); const data = await res.json();