swal.js 577 B

1234567891011121314151617181920
  1. var swalInit = swal.mixin({
  2. buttonsStyling: false,
  3. confirmButtonClass: 'btn btn-primary',
  4. cancelButtonClass: 'btn btn-light'
  5. }),
  6. alert = (msg, type, url, time = 500) => {
  7. swalInit.fire({
  8. title: 'Information',
  9. text: msg,
  10. type: ( type != undefined && type != '' ) ? type : 'info',
  11. timer: time
  12. }).then(function(){
  13. switch( url ){
  14. case 'reload' : location.reload(); break;
  15. default :
  16. if( url != undefined && url != '' ) window.location.replace(url);
  17. }
  18. });
  19. }