Vue axios request url always using local server url

  axios, laravel, vue.js

I need to consume external url api.
created an instance of axios with base url

export const regionClient = axios.create({
   baseUrl: "https://x.domain.com"
});

using it in a function

getToken() {
   const source = axios.CancelToken.source();

   store.commit("region/ADD_REQUEST", { key: "token", cancel: source.cancel });
   return regionClient({
      url: "/api",
      //result: "http://localhost/api"
      //needed: "https://x.domain.com/api"
   });
},

but it always using localhost server url

Source: Laravel

Leave a Reply