[Vuejs]-How to run a method in the background in vuejs

0👍

I’m not familiar with chatbox/drift, so I don’t know how you are obtaining the ‘drift’ instance, but I think that you are going to have to add some sort of async check for the availability of the ‘drift’ instance, so something like

   login() {
          var that = this;
    
          if (this.$refs.loginForm.validate()) {
            this.$axios.post('sign_in.json', { user: this.worker }).then(async function(response) {
              await getDrift().identify(response.data.worker.id, {
                email: response.data.worker.email
              })
              window.location.href = '/my_account';
            }).catch(function(error) {
              that.error = error;
            });
          }
     

Leave a comment