How to use the sweetalert2.mixin function in sweetalert2

To help you get started, we’ve selected a few sweetalert2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codeitlikemiley / vuetified / resources / js / modules / auth.js View on Github external
try {
      await vueAuth.login(form).then(() => {
        commit("isAuthenticated", {
          isAuthenticated: vueAuth.isAuthenticated()
        });
      });

      await dispatch("fetchMe");

      form.busy = false;
      vm.$router.push({ name: "dashboard" });
    } catch (error) {
      form.errors.set(error.response.data.errors);
      form.busy = false;
      if (error.response.status === 401) {
        let modal = swal.mixin({
          confirmButtonClass: "v-btn blue-grey  subheading white--text",
          buttonsStyling: false
        });
        modal.fire({
          title: `${error.response.data.error}`,
          html: `<p class="title">${error.response.data.message}</p>`,
          type: "error",
          confirmButtonText: "Back"
        });
      }
    }
  },
  /* form : name,email ,provider(fb),provider_user_id(fb_id) */
github codeitlikemiley / vuetified / resources / js / pages / User / Create.vue View on Github external
this.$validator.validateAll().then(result =&gt; {
        if (result) {
          // eslint-disable-next-line
          self.createUser();
        } else {
          const validationModal = swal.mixin({
            confirmButtonClass: "v-btn blue-grey  subheading white--text",
            buttonsStyling: false
          });
          validationModal.fire({
            title: `Validation Error`,
            html: `<p class="title">Please Fix Form Errors</p>`,
            type: "warning",
            confirmButtonText: "Back"
          });
        }
      });
    },
github csesumonpro / laravel-vue-js-super-blog / resources / js / app.js View on Github external
import {routes} from './routes';

Vue.component('example-component', require('./components/ExampleComponent.vue'));
Vue.component('admin-main', require('./components/admin/AdminMaster.vue'));
Vue.component('home-main', require('./components/public/PublicMaster.vue'));

// V-form
import { Form, HasError, AlertError } from 'vform'

Vue.component(HasError.name, HasError)
Vue.component(AlertError.name, AlertError)
window.Form = Form;
// Sweet alert 2
import swal from 'sweetalert2'
window.swal = swal;
const toast = swal.mixin({
    toast: true,
    position: 'top-end',
    showConfirmButton: false,
    timer: 3000
});

window.toast = toast

const router = new VueRouter({
    routes, // short for `routes: routes`
    mode:'hash',

})
github codeitlikemiley / vuetified / resources / js / pages / User / Index.vue View on Github external
.catch(errors =&gt; {
          console.log(errors);
          if (errors.response.data.message) {
            let toggleModal = swal.mixin({
              confirmButtonClass: "v-btn blue-grey  subheading white--text",
              buttonsStyling: false
            });
            toggleModal.fire({
              title: "Oops! Something Went Wrong...",
              html: '<p class="title">' + errors.response.data.message + "</p>",
              type: "error",
              confirmButtonText: "Back"
            });
          }
          self.selected = [];
          Bus.$emit("close-modal-mass-mail");
        });
    },
github codeitlikemiley / vuetified / resources / js / pages / User / Create.vue View on Github external
.then(response =&gt; {
          console.log(response.data);
          self.$validator.reset();
          const successModal = swal.mixin({
            confirmButtonClass: "v-btn blue-grey  subheading white--text",
            buttonsStyling: false
          });
          successModal.fire({
            title: "Success!",
            html: `<p class="title">User Has Been Created!</p>`,
            type: "success",
            confirmButtonText: "Ok"
          });
          self.$nextTick(() =&gt; self.$router.push({ name: "users" }));
        })
        .catch(errors =&gt; {});
github codeitlikemiley / vuetified / resources / js / components / modal / MassMail.vue View on Github external
this.$validator.validate().then(result =&gt; {
        if (result) {
          Bus.$emit("send-mass-mail", this.form);
        } else {
          let modal = swal.mixin({
            confirmButtonClass: "v-btn blue-grey  subheading white--text",
            buttonsStyling: false
          });
          modal.fire({
            title: "Validation Error!",
            html: '<p class="title">Please Complete Form To Send Mail!</p>',
            type: "error",
            confirmButtonText: "Back"
          });
        }
      });
    }
github mifi / lossless-cut / src / util.js View on Github external
} catch (err) {
    console.error('Failed to set output file modified time', err);
  }
}

async function transferTimestampsWithOffset(inPath, outPath, offset) {
  try {
    const stat = await fs.statAsync(inPath);
    const time = (stat.mtime.getTime() / 1000) + offset;
    await fs.utimesAsync(outPath, time, time);
  } catch (err) {
    console.error('Failed to set output file modified time', err);
  }
}

const toast = swal.mixin({
  toast: true,
  position: 'top',
  showConfirmButton: false,
  timer: 5000,
});

const errorToast = title => toast.fire({
  type: 'error',
  title,
});

async function showFfmpegFail(err) {
  console.error(err);
  return errorToast(`Failed to run ffmpeg: ${err.stack}`);
}
github sanjabteam / sanjab / resources / js / bootstrap.js View on Github external
window._ = require('lodash');

try {
    window.Vue = require('vue');
    window.Popper = require('popper.js').default;
    window.$ = window.jQuery = require('jquery');
    window.PerfectScrollbar = require('perfect-scrollbar').default;
    window.moment = require('moment');
    window.Swal = require('sweetalert2').mixin({
        customClass: {
            confirmButton: 'btn btn-success',
            cancelButton: 'btn btn-danger'
        },
        buttonsStyling: false,
    });

    require('bootstrap');
    require('bootstrap-material-design');
} catch (e) {
    console.error(e);
}

Vue.use(require('./plugin').default);
require('./material-dashboard');
require('./scripts');
github Hujjat / laravStart / resources / assets / js / app.js View on Github external
*/

require('./bootstrap');

window.Vue = require('vue');
import moment from 'moment';
import { Form, HasError, AlertError } from 'vform';

import Gate from "./Gate";
Vue.prototype.$gate = new Gate(window.user);


import swal from 'sweetalert2'
window.swal = swal;

const toast = swal.mixin({
  toast: true,
  position: 'top-end',
  showConfirmButton: false,
  timer: 3000
});

window.toast = toast;


window.Form = Form;
Vue.component(HasError.name, HasError)
Vue.component(AlertError.name, AlertError)

Vue.component('pagination', require('laravel-vue-pagination'));
github AnowarCST / laravel-vue-crud-starter / resources / js / app.js View on Github external
require('./bootstrap');

window.Vue = require('vue');
import moment from 'moment';

import { Form, HasError, AlertError } from 'vform';
window.Form = Form;

import Gate from "./Gate";
Vue.prototype.$gate = new Gate(window.user);

import Swal from 'sweetalert2';


const Toast = Swal.mixin({
    toast: true,
    position: 'top-end',
    showConfirmButton: false,
    timer: 3000,
    timerProgressBar: true,
    onOpen: (toast) => {
      toast.addEventListener('mouseenter', Swal.stopTimer)
      toast.addEventListener('mouseleave', Swal.resumeTimer)
    }
  })
window.Swal = Swal;
window.Toast = Toast;

import VueProgressBar from 'vue-progressbar'
Vue.use(VueProgressBar, {
    color: 'rgb(143, 255, 199)',