this.
This commit is contained in:
parent
bd21e0e004
commit
30eda498cb
@ -15,7 +15,7 @@ export default {
|
||||
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
|
||||
},
|
||||
css: [],
|
||||
plugins: [],
|
||||
plugins: ['~/plugins/inject.js'],
|
||||
components: true,
|
||||
buildModules: [],
|
||||
modules: ['nuxt-buefy', '@nuxtjs/axios', 'nuxt-socket-io'],
|
||||
|
75
plugins/inject.js
Normal file
75
plugins/inject.js
Normal file
@ -0,0 +1,75 @@
|
||||
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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user