I have this line of code:
axios.get(`https://dictapi.lexicala.com/search?source=global&language=sv&text=${keyWord}`).then(
not doing its job, but it carries my input with ${keyWord}. How do I put ${keyWord} into this line of code
url: 'https://dictapi.lexicala.com/search?source=global&language=sv&text=ett',
so that when I input searching content, my config.url changes accordingly.
search =()=>{
const {keyWordElement:{value:keyWord}} = this
PubSub.publish('msg',{isFirst:false, isLoading:true}
const axios = require('axios');
const config = {
method: 'get',
url: 'https://dictapi.lexicala.com/search?source=global&language=sv&text=ett',
headers: {
'Authorization': 'Basic xxxx'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
axios.get(`https://dictapi.lexicala.com/search?source=global&language=sv&text=${keyWord}`).then(
use this to dynamically change your URL.
url: 'https://dictapi.lexicala.com/search?source=global&language=sv&text=ett'+ keyWord