fix : X header add for E mandate
This commit is contained in:
@@ -14,8 +14,8 @@ interface SendOtpPayload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getStoredMobileNumber(): string {
|
function getStoredMobileNumber(): string {
|
||||||
// const mobileNumber = localStorage.getItem('remitter_mobile_no');
|
const mobileNumber = localStorage.getItem('remitter_mobile_no');
|
||||||
const mobileNumber = "7890544527";
|
// const mobileNumber = "7890544527";
|
||||||
if (!mobileNumber) throw new Error('Mobile number not found.');
|
if (!mobileNumber) throw new Error('Mobile number not found.');
|
||||||
return mobileNumber;
|
return mobileNumber;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect, Suspense } from "react";
|
||||||
import { Text, Button, TextInput, PasswordInput, Title, Card, Group, Flex, Box, Image, Anchor, Tooltip, Modal, Stack } from "@mantine/core";
|
import { Text, Button, TextInput, PasswordInput, Title, Card, Group, Box, Image } from "@mantine/core";
|
||||||
import { notifications } from "@mantine/notifications";
|
import { notifications } from "@mantine/notifications";
|
||||||
import { Providers } from "@/app/providers";
|
import { Providers } from "@/app/providers";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
@@ -13,7 +13,7 @@ import styles from './Login.module.css';
|
|||||||
import { useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
|
|
||||||
|
|
||||||
export default function Login() {
|
function LoginEmandate() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [CIF, SetCIF] = useState("");
|
const [CIF, SetCIF] = useState("");
|
||||||
const [psw, SetPsw] = useState("");
|
const [psw, SetPsw] = useState("");
|
||||||
@@ -26,7 +26,7 @@ export default function Login() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data) {
|
if (data) {
|
||||||
console.log("URL parameter 'data':", data);
|
console.log("URL parameter 'data':", data);
|
||||||
localStorage.setItem("Emendate_data",data);
|
localStorage.setItem("Emendate_data", data);
|
||||||
}
|
}
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ export default function Login() {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-Login-Type': 'emandate',
|
'X-Login-Type': 'eMandate',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
customerNo: CIF,
|
customerNo: CIF,
|
||||||
@@ -376,3 +376,12 @@ export default function Login() {
|
|||||||
</Providers>
|
</Providers>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default function Login() {
|
||||||
|
return (
|
||||||
|
<Suspense fallback={<div>Loading...</div>}>
|
||||||
|
<LoginEmandate />
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ export default function MandatePage() {
|
|||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
'X-Login-Type': 'emandate',
|
'X-Login-Type': 'eMandate',
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -182,7 +182,7 @@ export default function MandatePage() {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
'X-Login-Type': 'emandate',
|
'X-Login-Type': 'eMandate',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
mobileNumber: localStorage.getItem("userMobNo"),
|
mobileNumber: localStorage.getItem("userMobNo"),
|
||||||
@@ -220,7 +220,7 @@ export default function MandatePage() {
|
|||||||
try {
|
try {
|
||||||
const response = await fetch("/api/otp/send", {
|
const response = await fetch("/api/otp/send", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json",'X-Login-Type': 'emandate' },
|
headers: { "Content-Type": "application/json",'X-Login-Type': 'eMandate' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
mobileNumber: localStorage.getItem("userMobNo"),
|
mobileNumber: localStorage.getItem("userMobNo"),
|
||||||
type: "EMandate",
|
type: "EMandate",
|
||||||
@@ -264,7 +264,7 @@ export default function MandatePage() {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
'X-Login-Type': 'emandate',
|
'X-Login-Type': 'eMandate',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
otp: otp,
|
otp: otp,
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ export default function Login() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// await sendOtp({ type: 'LOGIN_OTP', username: CIF, mobileNumber: mobile });
|
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: "7890544527" });
|
||||||
notifications.show({
|
notifications.show({
|
||||||
color: 'orange',
|
color: 'orange',
|
||||||
title: 'OTP Required',
|
title: 'OTP Required',
|
||||||
@@ -67,8 +67,8 @@ export default function Login() {
|
|||||||
async function handleVerifyOtp(mobile?: string) {
|
async function handleVerifyOtp(mobile?: string) {
|
||||||
try {
|
try {
|
||||||
if (mobile) {
|
if (mobile) {
|
||||||
// await verifyLoginOtp(otp, mobile);
|
await verifyLoginOtp(otp, mobile);
|
||||||
await verifyLoginOtp(otp, '7890544527');
|
// await verifyLoginOtp(otp, '7890544527');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user