Tommy Cxxx says to Happy Web DeveloperFor fetch function addUser(details) { return fetch('https://api.example.com/user', { mode: 'cors', method: 'POST', credentials: 'include', body: JSON.stringify(details), headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-XSRF-TOKEN': getCookieValue('XSRF-TOKEN') } }).then(response => { return response.json().then(data => { if (response.ok) { return data; } else { return Promise.reject({status: response.status, data}); } }); }); }at Fri, Dec 1, 2017 4:54 PM