Level 58
To empty the input fields after submit, you can simply reset the form object to its initial state. You can do this by adding the following line of code to the saveSupply function after the await statement:
Object.assign(form, {
supply_name: "",
supply_email: "",
supply_phone: "",
supply_address: "",
supply_city: "",
supply_zip_code: "",
});
This will reset all the form fields to their initial empty state. Here's the updated saveSupply function:
const saveSupply = async () => {
await storeSupply({ ...form });
Object.assign(form, {
supply_name: "",
supply_email: "",
supply_phone: "",
supply_address: "",
supply_city: "",
supply_zip_code: "",
});
};