title: Javascript - Uncaught (in promise)
body: <p>I have a function on click for which I use <a href="https://limonte.github.io/sweetalert2/" rel="nofollow noreferrer">sweetalert2</a>. This is the function:</p>
  
  <pre><code>publish = function (article) {
     swal({
        title: "Skal du publisere?",
        text: null,
        type: "info",
        showCancelButton: true,
        cancelButtonText: "Avbyrt",
        cancelButtonColor: '#FFF',
        confirmButtonColor: "#2E112D",
        confirmButtonText: "Ja, publisere"
      }).then(function(){
          var articleId = $(article).val();
          $.post("/admin/articles/publish/article", {
              '_token' : $('meta[name="csrf-token"]').attr('content'),
              'articleId': articleId
          }).done(function(){
              $(article).hide();
              return swal({
                type: 'success',
                title: 'Du har publisert den artikkel.',
                showConfirmButton: false,
                timer: 1000
            });
        }).fail(function() {
            return swal({
              type: 'warning',
              title: 'Noeting gikk feil, prov igjen',
              showConfirmButton: false,
              timer: 1000
            });
          });
      }, function(dismiss) {
      // dismiss can be 'overlay', 'cancel', 'close', 'esc', 'timer'
        if (dismiss === 'cancel') { // you might also handle 'close' or 'timer' if you used those
        // ignore
        } else {
          throw dismiss;
        }
      })
  }
  </code></pre>
  
  <p>Everything works fine but I get an error for the timer:</p>
  
  <blockquote>
    <p>sweetalert2.min.js:1 Uncaught (in promise) timer</p>
  </blockquote>
  
  <p>How can I avoid that, what am I doing wrong?</p>