pagekit / vue-resource

The HTTP client for Vue.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Impossible to change Vue.http.headers.common['Authorization']

Chipsterjulien opened this issue · comments

Hello

I have an issue to change Vue.http.headers.common['Authorization']. I define it in main.js and after if it change, impossible to refresh it.
Is there any solutions ?

Best regards
JF

Hi, please post the code, maybe it will be easier

how change Vue.http.headers.common['Authorization'] in function ?

For example, for a POST request

this.$http.post('http://localhost:8080/api/v1/create-user', data-user,
        { 
          headers: {
           ...
            'Authorization': 'Basic YWRtaW46YWRtaW4='
           ...  
        }
        }).then(response => {
        console.log('Success : ' + JSON.stringify(response));
      }, response => {
        console.log('Error : ' + JSON.stringify(response));
      });

hmm ok but it's a local change while I'm trying to change it globally. I try to implement jwt

Hmm i did not understand , maybe take a look at : #305

thx, I will read it this afternoon

[](url)