logout.vue 806 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <div>
  3. <button class="icon" @click="logout" v-close-popover>
  4. <exitToAppIcon class="material-icons" />
  5. <span>{{ $t("logout") }}</span>
  6. </button>
  7. </div>
  8. </template>
  9. <script>
  10. import firebase from "firebase/app"
  11. import { fb } from "~/helpers/fb"
  12. import exitToAppIcon from "~/static/icons/exit_to_app-24px.svg?inline"
  13. export default {
  14. components: { exitToAppIcon },
  15. data() {
  16. return {
  17. fb,
  18. }
  19. },
  20. methods: {
  21. logout() {
  22. fb.currentUser = null
  23. const self = this
  24. firebase
  25. .auth()
  26. .signOut()
  27. .catch((err) => {
  28. self.$toast.show(err.message || err, {
  29. icon: "error",
  30. })
  31. })
  32. self.$toast.info(this.$t("logged_out"), {
  33. icon: "vpn_key",
  34. })
  35. },
  36. },
  37. }
  38. </script>