JSFiddle - React, Tailwind, and code Playground

by simati

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.9/vue.min.js"></script>
<script src="https://unpkg.com/[email protected]/vue-snotify.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.min.js"></script>
<div id="app">
  <button @click="load">Cargar</button>
   <vue-snotify></vue-snotify>
</div>

JavaScript

const app = new Vue({
 el: '#app',
 methods: {
 load() {
  this.$snotify.async('Called with promise', 'Success async', () => new Promise((resolve, reject) => {
     return axios.get('https://jsonplaceholder.typicode.com/users')
     .then(function (response) {
       resolve({
         title: 'Success!!!',
         body: 'We got an example success!',
         config: {
           closeOnClick: true
         }
       })
     })
     .catch(function (error) {
       reject({
         title: 'Error!!!',
         body: 'We got an example error!',
         config: {
           closeOnClick: true
         }
       })
     });
     
   }));
 }
 }
});