File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 1
- import React from "react" ;
1
+ import React , { useState } from "react" ;
2
2
import { Box , Button , TextField , Typography } from "@mui/material" ;
3
3
import { Link , useNavigate } from "react-router-dom" ;
4
4
import { apiAuth } from "../../services/models/authModel" ;
5
5
import { toast } from "react-hot-toast" ;
6
6
import * as Yup from "yup" ;
7
7
import { useFormik } from "formik" ;
8
+ import { ColorRing } from 'react-loader-spinner'
8
9
9
10
const Signup = ( ) => {
10
11
const navigate = useNavigate ( ) ;
12
+ const [ loading , setLoading ] = useState ( false )
13
+
11
14
12
15
const initialValues = {
13
16
email : "" ,
@@ -30,7 +33,7 @@ const Signup = () => {
30
33
initialValues,
31
34
validationSchema,
32
35
onSubmit : ( values ) => {
33
- // setLoading(true);
36
+ setLoading ( true ) ;
34
37
registerUser ( values . email , values . password ) ;
35
38
} ,
36
39
} ) ;
@@ -52,6 +55,8 @@ const Signup = () => {
52
55
} else {
53
56
toast . error ( "Error" ) ;
54
57
}
58
+ setLoading ( false )
59
+
55
60
} ) ;
56
61
} ;
57
62
@@ -97,8 +102,16 @@ const Signup = () => {
97
102
variant = "contained"
98
103
sx = { { display : "block" , mt : 2 , mx : "auto" } }
99
104
type = "submit"
105
+ disabled = { loading }
100
106
>
101
- Signup
107
+ { loading ? < ColorRing
108
+ visible = { true }
109
+ height = "30"
110
+ width = "30"
111
+ wrapperStyle = { { } }
112
+ wrapperClass = "blocks-wrapper"
113
+ colors = { [ '' ] }
114
+ /> : 'Signup' }
102
115
</ Button >
103
116
< Typography variant = "h6" component = "p" sx = { { my : 2 } } >
104
117
Have an account already ? Then{ " " }
You can’t perform that action at this time.
0 commit comments