@web3forms/react
Version:
Recieve form submissions directly to your inbox without any configuration. Powered by Web3forms. Integrates with react-hook-form and other form libs too!
2 lines (1 loc) • 421 B
JavaScript
module.exports=({access_key:e,settings:s={},onSuccess:t,onError:o})=>({submit:function(n){try{return Promise.resolve(fetch("https://api.web3forms.com/submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({access_key:e,...s,...n})})).then(function(e){return Promise.resolve(e.json()).then(function(e){!0===e.success?t(e.message,e):o(e.message,e)})})}catch(e){return Promise.reject(e)}}});