2

I am trying to pass an integer parameter in a axios get request, but at the browser Value of key 'this.look_data.value' is not a string!..here what I did,

axios.get(window.App.targetURL+'/ccc/xxx?getint='+encodeURIComponent(this.look_data.value), window.App.configuration)           
                .then(response => {                  
                  this.value = (give.data);
                  this.values = true;                    
                })
                .catch(e => {
                  alert(e);
                })

1 Answers1

1

try to explicit tranform it to string:

var d = new Date(this.look_data.value);

var options = {   
day: 'numeric', 
month: 'long', 
year: 'numeric'};

axios.get(window.App.targetURL+'/ccc/xxx?getint='+ encodeURIComponent(d.toLocaleDateString('en-US', options)), window.App.configuration)          
            .then(response => {                  
              this.value = (give.data);
              this.values = true;                    
            })
            .catch(e => {
              alert(e);
            })

if this not work try to transorm it in a formatted date. There are some librarie do this for you or see this post

Davide Castronovo
  • 1,366
  • 8
  • 21