add loading state
This commit is contained in:
1 parent
c0ad2dfce2
commit
b58fe4ae74
1 file changed
+7
-1
@@ -11,7 +11,7 @@ import { useTheme } from "@emotion/react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { networkService } from "../../../main";
|
import { networkService } from "../../../main";
|
||||||
import { newOrChangedCredentials } from "../../../Validation/validation";
|
import { newOrChangedCredentials } from "../../../Validation/validation";
|
||||||
@@ -35,6 +35,9 @@ const getFeedbackStatus = (form, errors, field, criteria) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Register = ({ superAdminExists }) => {
|
const Register = ({ superAdminExists }) => {
|
||||||
|
// Redux
|
||||||
|
const { isLoading } = useSelector((state) => state.auth);
|
||||||
|
|
||||||
// Local state
|
// Local state
|
||||||
const [form, setForm] = useState({
|
const [form, setForm] = useState({
|
||||||
firstName: "",
|
firstName: "",
|
||||||
@@ -203,6 +206,8 @@ const Register = ({ superAdminExists }) => {
|
|||||||
alignItems="center"
|
alignItems="center"
|
||||||
gap={theme.spacing(10)}
|
gap={theme.spacing(10)}
|
||||||
>
|
>
|
||||||
|
<Typography variant="h1">{t("auth.registration.heading.user")}</Typography>
|
||||||
|
|
||||||
<Stack
|
<Stack
|
||||||
component="form"
|
component="form"
|
||||||
width="100%"
|
width="100%"
|
||||||
@@ -327,6 +332,7 @@ const Register = ({ superAdminExists }) => {
|
|||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Button
|
<Button
|
||||||
|
disabled={isLoading}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="accent"
|
color="accent"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
|||||||
Reference in new issue
Block a user