is canvas a picture that has been encoded by base64? how can it be sent to the background or json?
fetch("/api/avatarUp",{
method:"POST",
headers: {
"Accept": "application/json",
"Content-Type":"application/json;charset=UTF-8"
},
body:JSON.stringify({avatar:canvas}),
}).then(res => res.blob())
.then(blob => (
img = window.URL.createObjectURL(blob),
this.setState({img})
)).catch(e => console.log(e))