@@ -18,6 +18,7 @@ import VisibilityOff from '@mui/icons-material/VisibilityOff';
18
18
import InputAdornment from '@mui/material/InputAdornment' ;
19
19
import apiClient from '../../services/apiClient' ;
20
20
import Swal from 'sweetalert2' ;
21
+ import { set } from 'date-fns' ;
21
22
22
23
function Copyright ( props ) {
23
24
return (
@@ -38,6 +39,7 @@ const defaultTheme = createTheme();
38
39
// This component is used to register a new user.
39
40
export default function SignUp ( ) {
40
41
42
+ const [ loading , setLoading ] = React . useState ( false ) ;
41
43
const [ passwordError , setPasswordError ] = React . useState ( '' ) ;
42
44
const [ emailError , setEmailError ] = React . useState ( '' ) ;
43
45
const [ nullError , setNullError ] = React . useState ( '' ) ;
@@ -87,6 +89,7 @@ export default function SignUp() {
87
89
88
90
const handleSubmit = async ( event ) => {
89
91
event . preventDefault ( ) ;
92
+ setLoading ( true ) ;
90
93
const data = new FormData ( event . currentTarget ) ;
91
94
const firstName = data . get ( 'firstName' ) ;
92
95
const username = data . get ( 'username' ) ;
@@ -123,7 +126,7 @@ export default function SignUp() {
123
126
} ) ;
124
127
console . error ( 'Error al enviar la solicitud:' , error . response . data ) ;
125
128
} ) ;
126
-
129
+ setLoading ( false ) ;
127
130
} ;
128
131
129
132
return (
@@ -227,14 +230,23 @@ export default function SignUp() {
227
230
/>
228
231
</ Grid >
229
232
</ Grid >
233
+ { loading ? (
234
+ < div className = "loader mt-5" >
235
+ < ThreeDots
236
+ color = "#86654B"
237
+ height = { 100 }
238
+ width = { 100 }
239
+ />
240
+ </ div >
241
+ ) :(
230
242
< Button
231
243
type = "submit"
232
244
fullWidth
233
245
variant = "contained"
234
246
sx = { { mt : 3 , mb : 2 } }
235
247
>
236
248
Sign Up
237
- </ Button >
249
+ </ Button > ) }
238
250
< Grid container justifyContent = "flex-end" >
239
251
< Grid item >
240
252
< Link href = "/login" variant = "body2" >
0 commit comments