Uname: Linux webm012.cluster130.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software: Apache
PHP version: 8.0.30 [ PHP INFO ] PHP os: Linux
Server Ip: 145.239.37.162
Your Ip: 216.73.216.190
User: dreampi (1009562) | Group: users (100)
Safe Mode: OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl

name : currentUserMixin.js
export default {
  data: () => ({}),

  methods: {
    getCurrentUser () {
      if (!('ameliaUser' in window)) {
        this.$http.get(`${this.$root.getAjaxUrl}/users/current`)
          .then(response => {
            window.ameliaUser = response.data.data.user ? JSON.parse(JSON.stringify(response.data.data.user)) : null

            this.setCurrentUser(window.ameliaUser)
          })
          .catch(e => {
            console.log('getCurrentUser fail')
          })
      } else {
        let ameliaApiInterval = setInterval(
          () => {
            if ('ameliaUser' in window) {
              clearInterval(ameliaApiInterval)

              this.setCurrentUser(JSON.parse(JSON.stringify(window.ameliaUser)))
            }
          },
          1000
        )
      }
    },

    setCurrentUser (user) {
      this.currentUser = user

      if (this.currentUser && this.appointment) {
        this.appointment.bookings[0].customerId = this.currentUser.id
        this.appointment.bookings[0].customer.id = this.currentUser.id
        this.appointment.bookings[0].customer.externalId = this.currentUser.externalId
        this.appointment.bookings[0].customer.email = this.currentUser.email
        this.appointment.bookings[0].customer.firstName = this.currentUser.firstName
        this.appointment.bookings[0].customer.lastName = this.currentUser.lastName
        this.appointment.bookings[0].customer.phone = this.currentUser.phone || ''
        this.appointment.bookings[0].customer.countryPhoneIso = this.currentUser.countryPhoneIso
        this.appointment.bookings[0].customer.translations = this.currentUser.translations

        this.phonePopulated = this.currentUser.phone ? this.currentUser.phone.trim() !== '' : false
      }
    }
  }

}
© 2026 GrazzMean-Shell