feat : fetch mobile number by api

This commit is contained in:
2025-10-13 13:40:23 +05:30
parent f394300498
commit 242e8d544b
4 changed files with 62 additions and 53 deletions

View File

@@ -14,6 +14,7 @@ import { generateCaptcha } from '@/app/captcha';
import { IconRefresh, IconShieldLockFilled } from "@tabler/icons-react";
import dayjs from "dayjs";
import { IconTrash } from "@tabler/icons-react";
import { fetchAndStoreUserName } from "../_util/userdetails";
export default function Login() {
@@ -46,7 +47,8 @@ export default function Login() {
}
try {
console.log(CIF);
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' });
return true;
}
catch (err: any) {
@@ -62,7 +64,8 @@ export default function Login() {
async function handleVerifyOtp(mobile?: string) {
try {
if (mobile) {
await verifyLoginOtp(otp, mobile);
// await verifyLoginOtp(otp, mobile);
await verifyLoginOtp(otp, '7890544527');
return true;
}
} catch {
@@ -422,10 +425,7 @@ export default function Login() {
localStorage.setItem("access_token", token);
localStorage.setItem("pswExpiryDate", data.loginPswExpiry);
if (
data.loginPswExpiry &&
dayjs(data.loginPswExpiry).diff(dayjs(), "day") < 0
) {
if (data.loginPswExpiry && dayjs(data.loginPswExpiry).diff(dayjs(), "day") < 0) {
notifications.show({
withBorder: true,
color: "orange",
@@ -437,6 +437,8 @@ export default function Login() {
return;
}
// Fetching mobile no and user name
await fetchAndStoreUserName(token);
if (data.FirstTimeLogin === true) {
router.push("/SetPassword");
} else {