Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

ApiService / Axios Base URL


I've updated the line:

ApiService.vueInstance.axios.defaults.baseURL = process.env.MY_API_URL;

(MY_API_URL = " just for reference

in order to point the app at my locally running API, but not matter what the base URL is always (the location the app is running under) when an Axios call get's executed. Am I missing something here?


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


Hi Ben,

We are using the VUE_APP_API_URL variable from the .env file inside the demo folder.

Most likely your MY_API_URL variable is undefined, to use .env variables in Vue, variable name should start with VUE_APP_, instead of MY_API_URL you should use VUE_APP_MY_API_URL.

Regards,
Lauris Stepanovs,
Keenthemes Support Team



The APIservice uses the .env file to run.

Reference this

https://preview.keenthemes.com/metronic8/vue/docs/#/api-setup


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(