import { useRef } from "react"; export default function AddTransaction() { const API_URL = "http://localhost:2500"; const tier = useRef(null); const enchantment = useRef(null); const silver = useRef(null); const type = useRef(null); const submit = () => { console.log("submit"); fetch(`${API_URL}/transactions`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ tier: Number(tier.current?.value), enchantment: Number(enchantment.current?.value), silver: Number(silver.current?.value), type: type.current?.value, }), }).then((response) => { if (response.ok) { console.log("Transaction added"); } else { console.error("Error adding transaction"); } }); }; return (

Add Transaction

); }