title: VueJs Axios and Typescript
body: <p>I was handed a base to develop a project on. It's made in Vue and Typescript, which doesn't have much support online.</p>
  
  <p>I currently need to make several API calls in order to check the availability of a service, and must do those inside a component. For some reason, I'm not able to figure how to do so.</p>
  
  <p>What I currently have is:</p>
  
  <pre><code>import * as Vue from 'vue';
  import { Component } from 'vue-property-decorator';
  import Axios, { AxiosInstance, AxiosRequestConfig, AxiosError, AxiosResponse, AxiosStatic } from 'axios';
  
  @Component({
  (...)  
  })
  
  export class Something extends Vue {
      public $http: Axios;
  constructor() {
      super();
      this.$http = Axios.create({
          baseURL: "https://swapi.co/api/people/1/"
      });
  }
  
  testFunc() {
      let data: any;
      this.$http.get("https://swapi.co/api/people/1/", data)
         .then((res: AxiosResponse) =&gt; {
          console.log(res.data);
       })
        .catch((ex: any) =&gt; {
          console.log(ex);
        });
   }
  
  
  }
  </code></pre>
  
  <p>There's several things that I've changed in order to get this to work, thus the code I've pasted counts more as a structure than anything else. I also have a button in my view that calls that testFunc(). Also, Axios doesn't get recognized as a type, and even if I import "axios" instead, it doesn't work. AxiosInstasnce does work, but gets me nowhere.</p>