JSFiddle - React, Tailwind, and code Playground

by KgomDr

JavaScript

fetch("api/KMZ/UpdateGroupsData", {
           method: "POST",
           headers: {
             Accept: "application/json, text/plain, */*",
             "Content-Type": "application/json"
           },
           body: JSON.stringify({
             segmentIds: Array.from(this.state.rows.keys()),
             type: event.target.id,
             name: this.state.groupValue
           })
         }).then(
             res => {
               console.log("response found");
               alert("res");
               return res.json();
             }
           )
           .then(data => {
             console.log("got data response");
             alert("data");
             console.log(data.response);
           })
           .catch(error => {
             alert("error");
             console.log("error in response");
           });