I am making a random color generator. When I refresh or click the generate button, the api gets the same result. But when I refresh the api site, the information changes randomly.
Here is the api site and the demo
const BASE_URL = 'https://www.colr.org/json/colors/random'
const colorCardsTotal = '5'
function getColors(){
axios.get(BASE_URL+'/'+colorCardsTotal)
.then(function (response) {
console.log(response.data.colors)
})
.catch(function (error) {
// 2.handle error
console.log(error)
})
}
getColors()
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>