How to fix a TypeError with wix-fetch

All this throws is a TypeError: Failed to fetch from the .catch, cant really find anything that is helping to resolve it. Yes the code on the page has a valid domain before that is asked but it wont let me post URL’s :slight_smile:

I removed the data & the headers to keep the fetch as simple as possible but even that fails.

Sorry if you want code put into code blocks but i do not see a button option for code tags…

import {fetch} from ‘wix-fetch’ ;

export function button18_click(event, $w) {
let first = $w( “#input23” ).value;
let last = $w( “#input20” ).value;

var data = {
‘first’ : first,
‘last’ : last
};

var headers = {
‘Content-Type’ : ‘application/json’ ,
}

fetch( 'link_here' , {method:  'post' }) 
    .then(httpResponse => 
    { 

if (httpResponse.ok)
return httpResponse.json();
else
return Promise.reject( ‘POST failed.’ );
})
. catch (err => console.log(err));
}

Anybody?

Did you manage to sort this out? I’m experiencing exactly the same problem when “fetching” the API of sendGrid. Other APIs work just fine…