diff --git a/src/components/Abonnement.js b/src/components/Abonnement.js index 4d66ec9..e9c1081 100644 --- a/src/components/Abonnement.js +++ b/src/components/Abonnement.js @@ -29,6 +29,7 @@ import img_logo_stripe from "./../mysy_img/logo-stripe-secure.png"; import SendIcon from '@mui/icons-material/Send'; import { confirmAlert } from 'react-confirm-alert'; // Import import { RiAddCircleLine } from "react-icons/ri"; +import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; function Abonnement(props) { @@ -488,7 +489,7 @@ function Abonnement(props) { getCurrentUserData(); GetPayementMode(); setpackprice(); - + }, []); @@ -759,6 +760,8 @@ function Abonnement(props) { }) } + const [isLoading, setLoading] = useState(); + const [neworderid, setneworderid] = useState(""); const [New_Ordervalidation_api, setNew_Ordervalidation_api] = useState(); const [New_Ordervalidation_message, setNew_Ordervalidation_message] = useState(); @@ -795,7 +798,8 @@ function Abonnement(props) { //form.append("1", JSON.stringify({ "code": "art_supp", "prix": "120", "comment": "nc" })); - + + setLoading(true); var myurl = process.env.REACT_APP_API_URL + "myclass/api/createOrder/"; fetch(myurl, @@ -817,11 +821,13 @@ function Abonnement(props) { // Mise à jour du plan de payement Update_Payement_Plan_Qty(); + setLoading(false); } else { setNew_Ordervalidation_api("false"); setNew_Ordervalidation_message(data['message']); + setLoading(false); } @@ -829,8 +835,10 @@ function Abonnement(props) { console.error('Error:', error); setneworderid(""); setNew_Ordervalidation_api("false"); + setLoading(false); }); + // setLoading(false); } @@ -952,6 +960,10 @@ function Abonnement(props) { return (