Please advise what exactly I should write instead of this phrase? To display receive user information from the database? after logging in
//ProfileDropDown.vue
<template>
<div class="text-right leading-tight hidden sm:block">
<p class="font-semibold">{{ activeUserInfo.displayName }}</p>
<small>Available</small>
</div>
</template>
<script>
export default {
data () {
return {
activeUserInfo: null
}
},
methods: {
async getUserInfo () {
try {
const res = await (write get request with axios to api)
this.activeUserInfo = (object from res)
} catch (e) {}
}
},
async created() {
await this.getUserInfo();
}
}
</script>
If you want get data with store, you can use axios in state.js
...
const getUserInfo = () => {
const userInfo = {}
try {
const res = await (write get request with axios to api)
userInfo = (object from res)
} catch (e) {}
return userInfo
}
...
What exactly should I write instead of this phrase? "write get request with axios to api" "object from res"