You can do this by using javascript’s own fetch or opting for lib as Xios.
it’s not very difficult;
This is the HTML
<form method="POST">
<input type="email" name="email" id="email" placeholder="Email" />
<input type="password" name="password" id="password" placeholder="Password" />
<button type="submit">Acessar Conta</button>
<form>
Javascript
const button = document.querySelector('button[type="submit"]');
const handleLogin = (event) => {
event.preventDefault();
const email = document.getElementById('email'),
password = document.getElementById('password');
fetch('http://myapi.com/api/v1/login', { email, password })
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.log(error))
}
button.addEventListener('click', handleLogin);