TF-94 Implementation of File Uploader Component

This commit is contained in:
2023-09-03 16:23:03 +03:30
parent 59e652c182
commit 38b22c6dad
10 changed files with 52 additions and 114 deletions

View File

@@ -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")}

View File

@@ -7,6 +7,7 @@ export const SEND_OTP_TOKEN = BASE_URL + "/otp";
export const REGISTER = BASE_URL + "/register";
export const USER_INFO = BASE_URL + "/profile/info";
export const SEND_LOAN_REQUEST_NAVGAN = BASE_URL + "/navgan/loan/store";
export const SHOW_LOAN_REQUEST_NAVGAN = BASE_URL + "/navgan/loan/index"
export const SHOW_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/index";
export const SEND_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/store";
export const UPDATE_LOAN_REQUEST_WELFARE = BASE_URL + "/refahi/loan/update/";