VueJs: Inertia event listener not working

1.8k views Asked by At

I am trying to use the event listeners with inertia.post, however I can't get it to do anything.

this.$inertia.post('/email/store', data, {
    onStart: () => this.sending = true, 
    onFinish: () => this.sending = false,
})

The actual post is working and it is being routed properly. However nothing else happens. Is there anything else I have to do in addition to this?

1

There are 1 answers

0
buddhaCode On

I'm having the same problem. Unfortunately, it's not working as documented. :(

Since, the method is returning a promise, you can workaround like this:

this.sending = true
this.$inertia.post('/email/store', data)
  .then(() => this.sending = false);

EDIT: Events have been introduced with version 0.3. Which version are you using?