Successful alert for the user with Vue

Asked

Viewed 77 times

0

I have a session in my application, where the user disables and activates documents, at the time it activates or disables wanted to show a successful Alert in the Vue.js standard, but I don’t know how.

The bottom one has the active code and disables the document, as I would give an Alert on the screen for the user that the operation ON or DISABLE worked?

methods: {
  handleDesactive() {
    if ( this.typeShow != 6 ) {
      axios.get(`/atas/${this.id}/desativar`)
        .then( res => eventHub.$emit('removeCard', this.id) );
        alert('You clicked the button!');
    } else {
      axios.get(`/atas/${this.id}/ativar`)
        .then( res => eventHub.$emit('removeCard', this.id) );
    }
  }
}
  • 1

    Utilize .then( () => alert("Deu certo") ) how much to use the axios

  • Beauty then( res => eventHub.$emit('removeCard', this.id) => alert("Deu certo") thus?

  • https://hastebin.com/kecefiwoka.js

  • There’s nothing in that hastebin

  • 1

    https://pastebin.com/qDVJD8XS

1 answer

2


axios.get(`/atas/${this.id}/ativar`)
  .then((res) => {
    eventHub.$emit('removeCard', this.id);
    alert('Deu certo');
  });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.