//api.commonItem
getCommonItem (value) {
let variable = ""
api.commonItem({value: value}).then(res => {
variable = res.data.name
console.log("",variable)
})
console.log("",variable)
return variable
},
I called the getCommonItem method twice and passed the parameters twice. I wanted to get a different value, but the second time it was empty. Is there something wrong with the logic? please help me to see if the request has not been completed. Variable has been return
.