TF-94 Implementation of File Uploader Component
This commit is contained in:
@@ -4,12 +4,13 @@ import {Button} from "@mui/material";
|
||||
import axios from "axios";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {useEffect} from "react";
|
||||
import {SEND_OTP_TOKEN} from "../data/apiRoutes";
|
||||
import {LOGIN, SEND_OTP_TOKEN} from "../data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
|
||||
const ResendToken = ({initialTimerValue, timer, setTimer, PhoneNumber}) => {
|
||||
const ResendToken = ({initialTimerValue, timer, setTimer, PhoneNumber, disabled}) => {
|
||||
const t = useTranslations();
|
||||
const {directionApp} = useDirection();
|
||||
|
||||
const requestServer = useRequest();
|
||||
// Countdown Timer
|
||||
useEffect(() => {
|
||||
let interval;
|
||||
@@ -26,21 +27,17 @@ const ResendToken = ({initialTimerValue, timer, setTimer, PhoneNumber}) => {
|
||||
// End Countdown Timer
|
||||
|
||||
// Handle Resend Token
|
||||
const handleResendClick = async () => {
|
||||
// work on it
|
||||
const handleResendClick = () => {
|
||||
if (timer != 0) return;
|
||||
Notifications(t, undefined);
|
||||
await axios
|
||||
.post(SEND_OTP_TOKEN, {
|
||||
requestServer(SEND_OTP_TOKEN, "post", {
|
||||
auth: false, data: {
|
||||
phone_number: PhoneNumber,
|
||||
})
|
||||
}
|
||||
})
|
||||
.then(function (response) {
|
||||
Notifications(t, response);
|
||||
setTimer(initialTimerValue);
|
||||
})
|
||||
.catch(function (error) {
|
||||
Notifications(t, error.response);
|
||||
});
|
||||
}).catch(function (error) {
|
||||
});
|
||||
};
|
||||
// End Handle Resend Token
|
||||
|
||||
@@ -60,6 +57,7 @@ const ResendToken = ({initialTimerValue, timer, setTimer, PhoneNumber}) => {
|
||||
<Button
|
||||
color="success"
|
||||
sx={{width: "120px", alignSelf: "center", mt: 0}}
|
||||
disabled={disabled}
|
||||
onClick={handleResendClick}
|
||||
>
|
||||
{t("resend_code")}
|
||||
|
||||
Reference in New Issue
Block a user