Reputation: 53
Is is possible to get the base URL from the axios and store it to a variable?
const instance = axios.create({
baseURL: "http://192.168.0.103/api",
});
What i want to do is..
const photo= "HTTP://192.168.0.103/" + image-Path;
this is working , but i don't want to use the address here (since i already declared it in axios file, i don't want to repeat it several pages), instead i want to get it from axios and use it here.
Is it even possible?
Upvotes: 0
Views: 1289
Reputation: 3187
This will work
const axios = require('axios');
const api = axios.create({
baseURL: "http://www.google.com.pk"
});
console.log(api.defaults.baseURL)
Upvotes: 1