How to get the value from the promise?

To simplify the work of a system call axios

In the component vue:
created () { //when creating
 var response = Service.getIP();
console.log(response);
 this.$store.dispatch('setIP', response); //go to action in the third-party file
 }

Service:
import Api from '@/services/Api'

export default {
 getIP () {
 return Api().get('/')
}
}

API:
import from axios 'axios'
var domain = 'localhost'
export default() => {
 return axios.create({
 baseURL: 'http://' + domain +':3000'
})
}


The problem is that Service.getIP() (in component vue) returns this:
5cc971c825d60617684526.png
How can I return data from this?

I tried this:
Service.getIP().then(res => { return res})
but it is not good
And so I tried:
getIP () {
 return Api().get('/').then(response => {console.log(response);return response})
 },

The output still promis...
March 20th 20 at 11:21
2 answers
March 20th 20 at 11:25
Solution
async methodName() {
 let result = await (Api).get('/');
}
March 20th 20 at 11:23
Solution
created() { //when creating
 Service.getIP().then(response => {
console.log(response);
 this.$store.dispatch('setIP', response); //go to action in the third-party file
})
}


or so
async created() { //when creating
 const ip = await Service.getIP();
 this.$store.dispatch('setIP', ip); //go to action in the third-party file
}

Find more questions by tags AJAXJavaScriptVue.js