Issue
I put this question up in order for easy access of the solution for fellow developers searching for an answer
//If you have an axios instance declared in a module similar to this, say, api.js
var axios = require('axios');
var axiosInstance = axios.create({
baseURL: 'https://example.com/foo/bar',
/* other custom settings */
});
module.exports = axiosInstance;
//If you are accessing the module somewhere else, like this
var api = require('./api');
api.get('relative/path') //For a typical get call using an instance
But, you want to find the baseURL for some business requirement from an axios instance and not necessarily make a call, how do you find it?
Solution
https://github.com/axios/axios#global-axios-defaults
in your case should be : baseURL = api.defaults.baseURL
Answered By - mrJQuery Answer Checked By - Marie Seifert (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.