pagekit / vue-resource

The HTTP client for Vue.js
MIT License
10.08k stars 1.6k forks source link

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

Open Chipsterjulien opened 6 years ago

Chipsterjulien commented 6 years ago

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

msouidi309 commented 6 years ago

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

Chipsterjulien commented 6 years ago

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

msouidi309 commented 6 years ago

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));
      });
Chipsterjulien commented 6 years ago

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

msouidi309 commented 6 years ago

Hmm i did not understand , maybe take a look at : https://github.com/pagekit/vue-resource/issues/305

Chipsterjulien commented 6 years ago

thx, I will read it this afternoon

emmanuelAjako commented 6 years ago

[](url)