Created
March 19, 2018 23:42
-
-
Save dapperAuteur/cfd4a8af3891dfc2e4b156e3dddd6d4f to your computer and use it in GitHub Desktop.
passing the token in the header to communicate user is authorized
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function updatePalabra(p, pObj) { | |
console.log(`${APIURL}${p}${pObj._id}`); | |
console.log(pObj); | |
let token = `Bearer ${pObj.token}`; | |
console.log(token); | |
return fetch(`${APIURL}${p}${pObj._id}`, { | |
method: 'put', | |
headers: new Headers({ | |
'Content-Type': 'application/json', | |
'Authorization': token | |
}), | |
body: JSON.stringify({ ...pObj }) | |
}) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment