mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-12-14 12:16:35 +00:00
fix: fix loading states in forms
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { useState } from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { Navigate, useLocation, useNavigate } from "react-router";
|
||||
|
||||
@@ -23,6 +24,12 @@ export const UnauthorizedPage = () => {
|
||||
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleRedirect = () => {
|
||||
setLoading(true);
|
||||
navigate("/login");
|
||||
};
|
||||
|
||||
let i18nKey = "unauthorizedLoginSubtitle";
|
||||
|
||||
@@ -53,7 +60,7 @@ export const UnauthorizedPage = () => {
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardFooter className="flex flex-col items-stretch">
|
||||
<Button onClick={() => navigate("/login")}>
|
||||
<Button onClick={handleRedirect} loading={loading}>
|
||||
{t("unauthorizedButton")}
|
||||
</Button>
|
||||
</CardFooter>
|
||||
|
||||
Reference in New Issue
Block a user