Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 139833

how to post the time ReactJs

$
0
0

I explain my problem of the day

in the following code, I post objects

my question, is it possible to post the time at which the post was made?

postbackend = () =>{
const config = {    
method: "POST",
headers: {
  "Content-Type": "application/json",
},
body: JSON.stringify({...this.state, items:this.props.items}),
};
const url = entrypoint + "/alluserpls"; 
fetch(url, config)
.then(res => res.json())
.then(res => {
  if (res.error) {
    alert(res.error);
  } else {
    alert(`ajouté avec l'ID ${res}!`);
  }
}).catch(e => {
  console.error(e);
}).finally(()=>this.setState({ redirect: true }));
}

I would simply like to recover the time at which the post was made Do you have an idea of how to fix this? Neff


Viewing all articles
Browse latest Browse all 139833

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>