use function in axios url code example
Example 1: axios get status code
axios.get('/foo')
.catch(function (error) {
if (error.response) {
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
}
});
Example 2: axios
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>