I have a problem to share data received by a personal API via axios.post:
On my initial File, i have:
axios
.post('myAPIURL', this.state)
.then(response => {
console.log(response.data.token)
I need to share response.data.token with other files to use this header. For example, on second file:
const res = await axios.post('myAPIURL', { hello: 'world' }, {
headers: {
'token': // I need for the response.data.token here
}
});
As there is an exchange of files, I am losing data and I am unable to simply export them.
Help me, plz!