UserTools.vue 719 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template lang="html">
  2. <div id="user-tools">
  3. <h4>{{ mail }}</h4>
  4. <a href="/admin/content/materials"
  5. v-if="isAdmin"
  6. >
  7. Admin
  8. </a>
  9. <a href="/user/logout"
  10. @click.prevent="onLogout()"
  11. >
  12. logout
  13. </a>
  14. </div>
  15. </template>
  16. <script>
  17. import { mapState, mapActions } from 'vuex'
  18. export default {
  19. // data () {
  20. // return {
  21. // mail: "Hello User!"
  22. // }
  23. // },
  24. computed: {
  25. ...mapState({
  26. mail: state => state.User.mail,
  27. isAdmin: state => state.User.isAdmin
  28. })
  29. },
  30. methods: {
  31. ...mapActions({
  32. userLogout: 'User/userLogout'
  33. }),
  34. onLogout () {
  35. this.userLogout()
  36. }
  37. }
  38. }
  39. </script>
  40. <style lang="css" scoped>
  41. </style>