Créez une promesse et retournez-la
let fetchSent = fetch("/test", {method:"POST", body: JSON.stringify({name:"NAME NAME NAME"}), headers: {'Content-type': 'application/json; charset=UTF-8'}});
const p1 = new Promise((resolve, reject) => {
resolve(fetchSent);
// or
// reject(new Error("Error!"));
})
return p1;
/*console.log(p1) will yield the fetch promise that was sent to you*/
Javasper