Refactor toast notifications and update MainForm submission messages

This commit is contained in:
2025-08-11 20:01:02 +02:00
parent 0a2f1e650d
commit 11384103c9
4 changed files with 14 additions and 5 deletions

View File

@@ -8,8 +8,6 @@ const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
const data = Object.fromEntries(formData.entries());
toast.promise(registerLos(data), {
pending: "Registriere Los...",
success: "Los erfolgreich registriert!",
error: "Fehler bei der Registrierung des Loses.",
});
};

View File

@@ -13,7 +13,18 @@ const Layout: React.FC<LayoutProps> = ({ children }) => {
<Header />
<main>{children}</main>
<footer></footer>
<ToastContainer />
<ToastContainer
position="top-right"
autoClose={5000}
hideProgressBar={false}
newestOnTop
closeOnClick
rtl={false}
pauseOnFocusLoss={false}
draggable
pauseOnHover
theme="light"
/>
</>
);
};

View File

@@ -11,7 +11,7 @@ export const registerLos = async (data: any) => {
if (response.ok) {
myToast("Los erfolgreich registriert!", "success");
} else {
myToast("Fehler bei der Registrierung des Loses.", "error");
myToast("Fehler bei der Registrierung des Loses!", "error");
}
});
};

View File

@@ -11,7 +11,7 @@ export const myToast = (message: string, msgType: ToastType) => {
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "dark",
theme: "light",
};
toast[msgType](message, config);
};