title: Setting axios base url dynamically
body: <p>i am getting base url from asyncstorage and i want to  set it as base url for axios instance.</p>
  
  <p>currently iam following below code but it is not working</p>
  
  <pre><code>const axiosInstance = axios.create({
   // baseURL: API_END_POINTS.BASE_URL+AsyncStorage.getItem('dealerNo'),
  });
  axiosInstance.defaults.timeout = 10000000;
  axiosInstance.interceptors.request.use(
    async config =&gt; {
  axiosInstance.defaults.baseURL=await getBaseUrl();
      return config;
    },
    error =&gt; Promise.reject(error)
  );
  
    export async  function getBaseUrl() {
      var No = await AsyncStorage.getItem('dealerNo')
      var value =API_END_POINTS.BASE_URL+  No;
      return value;
    }
  
  
  axiosInstance.defaults.headers.post['Content-Type'] = 'application/json';
  export default axiosInstance;
  </code></pre>
  
  <p>iam importing the above axiosInstance to make get or post calls.</p>