Files
2021-11-28 23:28:05 -06:00

75 lines
1.9 KiB
Vue

<template>
<section class="container px-2 pb-6">
<BotonRegresar path="/admin/responsables" />
<InformacionResponsable
:admin="admin"
:imprimirError="imprimirError"
:updateIsLoading="updateIsLoading"
/>
<BotonRegresar path="/admin/responsables" />
<b-loading :is-full-page="true" :can-cancel="false" v-model="isLoading" />
</section>
</template>
<script>
import BotonRegresar from '@/components/botonRegresar'
import InformacionResponsable from '@/components/admin/InformacionResponsable'
export default {
components: {
BotonRegresar,
InformacionResponsable,
},
data() {
return {
isLoading: false,
admin: {},
}
},
methods: {
updateIsLoading(booleanValue) {
this.isLoading = booleanValue
},
imprimirError(err = {}, title = '¡Hubo un error!', onConfirm = () => {}) {
this.$buefy.dialog.alert({
ariaRole: 'alertdialog',
ariaModal: true,
type: 'is-danger',
title,
message: err.message,
confirmText: 'Entendido',
hasIcon: true,
iconPack: 'mdi',
icon: 'alert-octagon',
onConfirm: () => onConfirm(),
})
if (err.err && err.err === 'token error') {
localStorage.clear()
this.$router.push('/')
}
},
getLocalhostInfo() {
this.admin.idUsuario = Number(localStorage.getItem('idUsuario'))
this.admin.idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
this.admin.token = {
headers: {
token: localStorage.getItem('token'),
},
}
},
},
created() {
this.getLocalhostInfo()
if (this.admin.idTipoUsuario === 2) this.$router.push('/responsable')
if (this.admin.idTipoUsuario === 3) this.$router.push('/alumno')
if (this.admin.idTipoUsuario === 4) this.$router.push('/casoEspecial')
},
}
</script>
<style scoped></style>