var get = localStorage.getItem("token"); var token = JSON.parse(get);
function myfun(){
fetch(url,{
method: 'POST',
headers:{
"Authorization":`Bearer + ${token}`
},
body:JSON.stringify({
city: account_city.value,
district: account_dis.value,
state: account_state.value,
})
})
.then((res)=> res.json())
.then(data=> console.log(data));
}
I try this code. Please help!!!!
myfun()is being called too. Apart from not knowing where the account variables are coming from, it looks correct. Do you know how to await for the promise to resolve?500 (Internal Server Error)that's a problem with (your?) server code