Merge pull request #1219 from bluewave-labs/fix/fe/login-loading
fix: FE loading button on login page, resolves #1122
This commit is contained in:
2 files changed
+13
-3
No files matched your search
@@ -4,6 +4,7 @@ import { Box, Button, Stack, Typography } from "@mui/material";
|
|||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { credentials } from "../../Validation/validation";
|
import { credentials } from "../../Validation/validation";
|
||||||
import { login } from "../../Features/Auth/authSlice";
|
import { login } from "../../Features/Auth/authSlice";
|
||||||
|
import LoadingButton from "@mui/lab/LoadingButton";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { createToast } from "../../Utils/toastUtils";
|
import { createToast } from "../../Utils/toastUtils";
|
||||||
import { networkService } from "../../main";
|
import { networkService } from "../../main";
|
||||||
@@ -233,6 +234,7 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const inputRef = useRef(null);
|
const inputRef = useRef(null);
|
||||||
|
const authState = useSelector((state) => state.auth);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inputRef.current) {
|
if (inputRef.current) {
|
||||||
@@ -306,10 +308,11 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
<ArrowBackRoundedIcon />
|
<ArrowBackRoundedIcon />
|
||||||
Back
|
Back
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<LoadingButton
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
loading={authState.isLoading}
|
||||||
disabled={errors.password && true}
|
disabled={errors.password && true}
|
||||||
sx={{
|
sx={{
|
||||||
width: "30%",
|
width: "30%",
|
||||||
@@ -321,7 +324,7 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</Button>
|
</LoadingButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
|
|||||||
@@ -70,7 +70,13 @@ const baseTheme = (palette) => ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
props: (props) => props.variant === "contained" && props.disabled,
|
props: (props) => {
|
||||||
|
return (
|
||||||
|
props.variant === "contained" &&
|
||||||
|
props.disabled &&
|
||||||
|
props.classes.loadingIndicator === undefined // Do not apply to loading button
|
||||||
|
);
|
||||||
|
},
|
||||||
style: {
|
style: {
|
||||||
backgroundColor: `${theme.palette.secondary.main} !important`,
|
backgroundColor: `${theme.palette.secondary.main} !important`,
|
||||||
color: `${theme.palette.secondary.contrastText} !important`,
|
color: `${theme.palette.secondary.contrastText} !important`,
|
||||||
@@ -90,6 +96,7 @@ const baseTheme = (palette) => ({
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
MuiIconButton: {
|
MuiIconButton: {
|
||||||
styleOverrides: {
|
styleOverrides: {
|
||||||
root: ({ theme }) => ({
|
root: ({ theme }) => ({
|
||||||
|
|||||||
Reference in new issue
Block a user