I am using Heroku for a hobby application. On my app, I have a frontend which at times stores the token for a user like so:
/**
* Fetch JSON Web token to be used for requests
*/
let token = localStorage.getItem('id_token');
Then in the same file, before I make requests to my API I check that the token exists like so:
fetchClient(context, id) {
if (token !== null) {
axios.get(
'api/clients/' + id + '?token=' + token,
).then(response => {
let responseData = response.data;
context.client = responseData.data;
})
}
}
This works fine on my local however after deploying my app to heroku, the request is not made as it seems that the token is not available in local storage?
Is there a way to get around this?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire