76 lines
1.5 KiB
JavaScript
76 lines
1.5 KiB
JavaScript
![]() |
const alertsGenericos = {
|
||
|
imprimirError(
|
||
|
buefy,
|
||
|
err = {},
|
||
|
title = '¡Hubo un error!',
|
||
|
onConfirm = () => {}
|
||
|
) {
|
||
|
buefy.dialog.alert({
|
||
|
ariaModal: true,
|
||
|
hasIcon: true,
|
||
|
onConfirm,
|
||
|
ariaRole: 'alertdialog',
|
||
|
confirmText: 'Entendido',
|
||
|
icon: 'alert-octagon',
|
||
|
iconPack: 'mdi',
|
||
|
message: err.message,
|
||
|
title,
|
||
|
type: 'is-danger',
|
||
|
})
|
||
|
// if (err.err && err.err === 'token error') {
|
||
|
// localStorage.clear()
|
||
|
// this.$router.push('/')
|
||
|
// }
|
||
|
},
|
||
|
imprimirMensaje(
|
||
|
buefy,
|
||
|
message,
|
||
|
onConfirm = () => {},
|
||
|
title = '¡Felicidades!'
|
||
|
) {
|
||
|
buefy.dialog.alert({
|
||
|
ariaModal: true,
|
||
|
hasIcon: true,
|
||
|
onConfirm,
|
||
|
ariaRole: 'alertdialog',
|
||
|
confirmText: 'Ok',
|
||
|
icon: 'check-circle',
|
||
|
iconPack: 'mdi',
|
||
|
message,
|
||
|
title,
|
||
|
type: 'is-success',
|
||
|
})
|
||
|
},
|
||
|
imprimirWarning(
|
||
|
buefy,
|
||
|
message,
|
||
|
onConfirm = () => {},
|
||
|
title = '¡Espera un minuto!',
|
||
|
onCancel = () => {}
|
||
|
) {
|
||
|
buefy.dialog.alert({
|
||
|
ariaModal: true,
|
||
|
canCancel: true,
|
||
|
hasIcon: true,
|
||
|
onCancel,
|
||
|
onConfirm,
|
||
|
ariaRole: 'alertdialog',
|
||
|
cancelText: 'Cancelar',
|
||
|
confirmText: 'Confirmar',
|
||
|
icon: 'help-circle',
|
||
|
iconPack: 'mdi',
|
||
|
message,
|
||
|
title,
|
||
|
type: 'is-warning',
|
||
|
})
|
||
|
},
|
||
|
getLocalhostInfo() {
|
||
|
const objeto = JSON.parse(localStorage.getItem('usuario'))
|
||
|
this.admin = objeto.operador
|
||
|
},
|
||
|
}
|
||
|
|
||
|
export default ({ app }, inject) => {
|
||
|
inject('alertsGenericos', alertsGenericos)
|
||
|
}
|