actions: {
GET_USER({commit}, payload) {
return axios(`/api/users/${payload.user}`, {
method: "GET"
})
.then((user) => {
commit('SET_USER_TO_STATE', user.data);
return user;
})
.catch(error => {
console.log(error);
return error;
})
}
},
export default {
props: [
'id'
],
data() {
return {
avatar:'',
}
},
mounted() {
this.getUser()
},
methods: {
getUser() {
this.$store.dispatch('GET_USER', this.id)
}
}
}
<Avatar v-bind:avatar ="'{{ Auth::user()->avatar }}'"></Avatar>