fix: fix loading states in forms

This commit is contained in:
Stavros
2025-05-30 18:14:33 +03:00
parent 75f07a9d7f
commit 34c8d16c7d
7 changed files with 54 additions and 24 deletions

View File

@@ -6,12 +6,19 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router";
export const NotFoundPage = () => {
const { t } = useTranslation();
const navigate = useNavigate();
const [loading, setLoading] = useState(false);
const handleRedirect = () => {
setLoading(true);
navigate("/");
};
return (
<Card className="min-w-xs sm:min-w-sm">
@@ -20,7 +27,7 @@ export const NotFoundPage = () => {
<CardDescription>{t("notFoundSubtitle")}</CardDescription>
</CardHeader>
<CardFooter className="flex flex-col items-stretch">
<Button onClick={() => navigate("/")}>{t("notFoundButton")}</Button>
<Button onClick={handleRedirect} loading={loading}>{t("notFoundButton")}</Button>
</CardFooter>
</Card>
);