materio-d9/web/themes/custom/materiotheme/vuejs/components/User/UserTools.vue

58 lines
1017 B
Vue
Raw Permalink Normal View History

2019-04-10 10:47:45 +02:00
<template lang="html">
<div id="user-tools">
2019-05-19 17:26:13 +02:00
<h4
class="mdi mdi-account"
>{{ mail }}</h4>
2019-05-17 18:57:24 +02:00
<a href="/admin/content/materials"
v-if="isAdmin"
2019-05-19 17:26:13 +02:00
class="mdi mdi-settings"
title="admin"
2019-05-19 17:26:13 +02:00
></a>
2019-04-10 10:47:45 +02:00
<a href="/user/logout"
@click.prevent="onLogout()"
2019-05-19 17:26:13 +02:00
class="mdi mdi-logout"
title="logout"
></a>
2019-04-10 10:47:45 +02:00
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
// data () {
// return {
// mail: "Hello User!"
// }
// },
computed: {
...mapState({
2019-05-17 18:57:24 +02:00
mail: state => state.User.mail,
isAdmin: state => state.User.isAdmin
2019-04-10 10:47:45 +02:00
})
},
methods: {
...mapActions({
userLogout: 'User/userLogout'
}),
onLogout () {
console.log('UserTools onLogout');
2019-04-10 10:47:45 +02:00
this.userLogout()
}
}
}
</script>
<style lang="css" scoped>
#user-tools{
margin-right:0.5em;
padding-right:0.5em;
border-right:1px solid #222;
}
2019-05-19 17:26:13 +02:00
h4{
margin:0;
2019-05-19 17:26:13 +02:00
display:inline-block;
font-size:inherited;
}
2019-04-10 10:47:45 +02:00
</style>