Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. import Vue from "vue"
  2.  
  3. import SecurityContext from "mmr/security/store"
  4. import Moment from "moment"
  5.  
  6. import Picker from "mmr/adaccount/Picker.vue"
  7. import Notification from "./notification/Notification.vue"
  8. import SwitchUser from "mmr/switch-user/SwitchUser.vue"
  9. import Plans from "mmr/components/plans/Plans.vue"
  10.  
  11. import { User } from "mmr/security/types/user"
  12.  
  13. export default Vue.extend({
  14. props: {
  15. },
  16. data() {
  17. return {
  18. currentUser: null as User | null,
  19. loadingSwitchCompany: false,
  20. loadingSwitchUser: false,
  21. showPlans: false,
  22. trialRemainingTime: null as any,
  23. }
  24. },
  25. computed: {
  26. loggedIn() {
  27. return SecurityContext.getters.isLoggedIn()
  28. },
  29. user() {
  30. return SecurityContext.getters.getUser()
  31. },
  32. userName() {
  33. return this.user.name.split(" ").map(n => n[0]).join("")
  34. },
  35. },
  36. methods: {
  37. timeAgo(date: string) {
  38. return Moment(date).fromNow()
  39. },
  40. homeRoute() {
  41. if (this.$route.name === "Home")
  42. return {
  43. name: "Home",
  44. params: this.$route.params,
  45. }
  46. return {
  47. name: "Home",
  48. }
  49. },
  50. async logOut() {
  51. await SecurityContext.actions.logOut()
  52. this.$router.push({
  53. name: "Login",
  54. })
  55. },
  56. showSearchModal() {
  57. // TODO: Handle modal when it comes back
  58. // this.headerBus.$emit("header:search:show")
  59. },
  60. },
  61. components: {
  62. adaccountPicker: Picker,
  63. Notification,
  64. SwitchUser,
  65. Plans,
  66. },
  67. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement