export class PaymentForm extends HTMLFormElement{
    connectedCallback() {
        this.addEventListener('submit',(e)=>{
            e.preventDefault();

            let inputs ={};
            this.querySelectorAll('input').forEach(input=>{
                inputs[input.name] = input.value
            })
            this.querySelectorAll('textarea').forEach(input=>{
                inputs[input.name] = input.value
            })

            fetch("/dons",{
                method:"POST",
                body:JSON.stringify(inputs)
            }).then(rslt=>rslt.json())
                .then((reslt)=>{
                    console.log(reslt)
                })
        })
    }
}
