S
S
Sergey750il2021-05-15 00:37:39
Vue.js
Sergey750il, 2021-05-15 00:37:39

How to update axios http header?

Good day. How to dynamically update the http header in axios when receiving a token? Now, upon receipt, the token changes in the state, but the requests come with the old token in the header, you have to completely refresh the page so that the requests begin to be sent with the new header. Why is it necessary to reload the page to change the title?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
coderisimo, 2021-05-15
@Sergey750il

axios.defaults.headers.common['Auth-Token'] = 'new token';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question