Skip to content

Instantly share code, notes, and snippets.

@xtrasmal
Created March 21, 2016 22:51
Show Gist options
  • Save xtrasmal/98b9c48e3b4b806a2269 to your computer and use it in GitHub Desktop.
Save xtrasmal/98b9c48e3b4b806a2269 to your computer and use it in GitHub Desktop.
Vue Flasher with alertify.js
import alertify from 'alertify.js';
const Flasher = {
success(thing, action) {
alertify.logPosition("top right");
alertify.success(`Het ${thing} is ${action}.`);
},
error(thing, action) {
alertify.logPosition("top right");
alertify.error(`Het ${thing} kon niet worden ${action}.`);
},
delete(origin, event, uuid) {
const caller = origin;
const evt = event;
const id = uuid;
alertify
.okBtn("Ja ik weet het zeker")
.cancelBtn("Nee")
.confirm("Weet je het zeker?", () => {
caller.$emit(evt, id);
}, () => {
alertify
.logPosition("top right")
.error("Het item is niet verwijderd.");
});
}
};
export default Flasher;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment