fixed server issue on document

This commit was merged in pull request #8.
This commit is contained in:
2023-10-21 22:39:08 -07:00
parent c48c959749
commit eceb3178fd
3 changed files with 22 additions and 6 deletions
+13 -2
View File
@@ -25,6 +25,8 @@ const SignInForm = () => {
password: false,
});
const [loading, setLoading] = useState(false);
const [errMsg, setErrMsg] = useState("");
const api = new Fetcher();
const router = useRouter();
@@ -68,6 +70,12 @@ const SignInForm = () => {
if (res.status === 204 || res.length === 0) {
setErrorHandlers({ ...errorHandlers, email: true, password: true });
setErrMsg("Wrong Credentials");
setTimeout(() => {
setErrorHandlers({ ...errorHandlers, email: false, password: false });
setLoading(false);
setErrMsg("");
}, 1500);
}
// Store the token in cookies
@@ -239,8 +247,9 @@ const SignInForm = () => {
variant="contained"
loading={loading}
disabled={loading}
// loadingPosition="end"
loadingIndicator="Signing in…"
sx={{
backgroundColor: "#4687BA",
textTransform: "capitalize",
borderRadius: "8px",
fontWeight: "500",
@@ -252,7 +261,9 @@ const SignInForm = () => {
},
}}
>
<span>Sign In</span>
<span>
{loading ? "Signing in…" : errMsg ? errMsg : "Sign In"}
</span>
</LoadingButton>
</Box>
</Box>