54 lines
1.2 KiB
Vue
54 lines
1.2 KiB
Vue
<template>
|
|
<section>
|
|
<Login :updateIsLoading="updateIsLoading" />
|
|
|
|
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
|
|
</section>
|
|
</template>
|
|
|
|
<script>
|
|
import jwt_decode from 'jwt-decode'
|
|
import Login from '@/components/admin/Login'
|
|
|
|
export default {
|
|
components: { Login },
|
|
data() {
|
|
return { isLoading: false }
|
|
},
|
|
methods: {
|
|
updateIsLoading(booleanValue) {
|
|
this.isLoading = booleanValue
|
|
},
|
|
},
|
|
created() {
|
|
const token = this.$getToken.tokenStr()
|
|
let operador
|
|
|
|
try {
|
|
if (token) operador = jwt_decode(token)
|
|
} catch (err) {
|
|
operador = null
|
|
}
|
|
if (
|
|
token &&
|
|
operador &&
|
|
operador.id_operador &&
|
|
operador.tipoUsuario.id_tipo_usuario &&
|
|
operador.id_operador &&
|
|
((operador.tipoUsuario.id_tipo_usuario === 2 && !operador.institucion) ||
|
|
(operador.tipoUsuario.id_tipo_usuario != 2 &&
|
|
operador.institucion.id_institucion))
|
|
) {
|
|
if (operador.tipoUsuario.id_tipo_usuario === 2)
|
|
this.$router.push(
|
|
'/admin/configuracion/instituciones/buscar_institucion'
|
|
)
|
|
else this.$router.push('/prestamo_devolucion')
|
|
} else localStorage.clear()
|
|
},
|
|
layout: 'login',
|
|
}
|
|
</script>
|
|
|
|
<style scoped></style>
|