Added rudimentary error handling and a comment to add admin component

This commit is contained in:
LosEvons
2025-09-17 10:32:01 +03:00
parent 76921b854d
commit b74576c06d
+8 -3
View File
@@ -5,12 +5,17 @@ import { useState } from "react";
export default function AddAdmin() {
const [email, setEmail] = useState("");
const [error, setError] = useState(null);
const request = useRequest();
const handleSubmit = async function () {
const _ = await request("admin/add-admin", {
email: email,
});
try {
const _ = await request("admin/add-admin", {
email: email,
}); // Tässä pitäisi todennäköisesti tapahtua jotain nextjs magiaa tolla router.push komennolla
} catch (error) {
setError(error.message);
}
};
return (