Skip to content

Commit 6ab2f82

Browse files
authored
Merge pull request #29 from Naetffy/Mateo
Mateo
2 parents ce03e3a + 03e6e18 commit 6ab2f82

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/pages/Register/Register.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import VisibilityOff from '@mui/icons-material/VisibilityOff';
1818
import InputAdornment from '@mui/material/InputAdornment';
1919
import apiClient from '../../services/apiClient';
2020
import Swal from 'sweetalert2';
21+
import { set } from 'date-fns';
2122

2223
function Copyright(props) {
2324
return (
@@ -38,6 +39,7 @@ const defaultTheme = createTheme();
3839
// This component is used to register a new user.
3940
export default function SignUp() {
4041

42+
const [loading, setLoading] = React.useState(false);
4143
const [passwordError, setPasswordError] = React.useState('');
4244
const [emailError, setEmailError] = React.useState('');
4345
const [nullError, setNullError] = React.useState('');
@@ -87,6 +89,7 @@ export default function SignUp() {
8789

8890
const handleSubmit = async (event) => {
8991
event.preventDefault();
92+
setLoading(true);
9093
const data = new FormData(event.currentTarget);
9194
const firstName = data.get('firstName');
9295
const username = data.get('username');
@@ -123,7 +126,7 @@ export default function SignUp() {
123126
});
124127
console.error('Error al enviar la solicitud:', error.response.data);
125128
});
126-
129+
setLoading(false);
127130
};
128131

129132
return (
@@ -227,14 +230,23 @@ export default function SignUp() {
227230
/>
228231
</Grid>
229232
</Grid>
233+
{loading ? (
234+
<div className="loader mt-5">
235+
<ThreeDots
236+
color="#86654B"
237+
height={100}
238+
width={100}
239+
/>
240+
</div>
241+
) :(
230242
<Button
231243
type="submit"
232244
fullWidth
233245
variant="contained"
234246
sx={{ mt: 3, mb: 2 }}
235247
>
236248
Sign Up
237-
</Button>
249+
</Button>)}
238250
<Grid container justifyContent="flex-end">
239251
<Grid item>
240252
<Link href="/login" variant="body2">

0 commit comments

Comments
 (0)