document.getElementById('admin-login-form').onsubmit = function (e) { e.preventDefault(); fetch('/admin/login', { method: 'POST', body: new URLSearchParams(new FormData(e.target)) }).then(res => { if (res.status >= 200 && res.status < 400) { console.log(res) window.location = '/admin_app/auth/'; } }).catch(err => console.log(err)) }