pcpuma_unam_operador/pages/index.vue

45 lines
962 B
Vue
Raw Normal View History

2022-05-25 03:38:17 +00:00
<template>
2022-08-14 22:23:01 +00:00
<section>
2022-07-11 14:15:10 +00:00
<Login :updateIsLoading="updateIsLoading" />
2022-05-25 03:38:17 +00:00
2022-08-29 02:56:55 +00:00
<b-loading :can-cancel="false" v-model="isLoading" is-full-page />
2022-05-25 03:38:17 +00:00
</section>
</template>
<script>
2022-08-11 21:39:12 +00:00
import jwt_decode from 'jwt-decode'
2022-08-03 23:05:17 +00:00
import Login from '@/components/operador/Login'
2022-05-25 03:38:17 +00:00
export default {
components: { Login },
data() {
2022-07-29 19:56:41 +00:00
return { isLoading: false }
2022-05-25 03:38:17 +00:00
},
methods: {
updateIsLoading(booleanValue) {
this.isLoading = booleanValue
},
},
created() {
2022-08-11 21:39:12 +00:00
const token = this.$getToken.tokenStr()
2022-08-14 22:23:01 +00:00
let operador
2022-07-29 19:56:41 +00:00
2022-08-14 22:23:01 +00:00
try {
if (token) operador = jwt_decode(token)
} catch (err) {
operador = null
}
2022-09-14 16:07:28 +00:00
if (token && operador) {
2022-07-29 19:56:41 +00:00
if (operador.tipoUsuario.id_tipo_usuario === 2)
this.$router.push(
'/admin/configuracion/instituciones/buscar_institucion'
)
else this.$router.push('/prestamo_devolucion')
} else localStorage.clear()
2022-05-25 03:38:17 +00:00
},
layout: 'login',
}
</script>
<style scoped></style>