Here is another possibility for idiots like myself who did this ...
<form action="blah">
<button onClick="javascript:submitForm();">Do It</button>
</form>
function submitForm() {
fetch('https://api.mailerlite.com/api/v2/groups/group_name/subscribers', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
}
}
This will give the dreaded TypeError: cancelled
It's because its breaking off the connection and trying to do the post of the actual form you defined (which wasn't even going anywhere)
SOLUTION:
<form action="blah">
<button onClick="javascript:submitForm(event);">Do It</button>
</form>
function submitForm(event) {
event.preventDefault()
fetch('https://api.mailerlite.com/api/v2/groups/group_name/subscribers', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
}
}
This passes the event thru to the function where you can cancel the Form submission (using preventDefault) and then get on with your fetch.
Very simple stuff, but very easy to forget and have you pulling your hair out, especially coupled with that Fantastically Descriptive and Useful error message.