pcpuma_unam_operador/components/super_admin/Instituciones.vue
2022-07-26 16:27:10 -05:00

46 lines
1.1 KiB
Vue

<template>
<TablaInstituciones
:instituciones="instituciones"
:total="instituciones.length"
:isLoadingTable="isLoadingTable"
:obtenerInstituciones="obtenerInstituciones"
/>
</template>
<script>
import axios from 'axios'
import TablaInstituciones from '@/components/tablas/TablaInstituciones'
export default {
components: { TablaInstituciones },
data() {
return {
instituciones: [],
isLoadingTable: false,
}
},
methods: {
obtenerInstituciones() {
this.isLoadingTable = true
axios
.get(
`${process.env.api}/institucion/instituciones`,
this.$getToken.token()
)
.then((res) => {
for (let i = 0; i < res.data.length; i++)
if (res.data[i].responsable) this.instituciones.push(res.data[i])
this.isLoadingTable = false
})
.catch((err) => {
this.isLoadingTable = false
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
})
},
},
created() {
this.obtenerInstituciones()
},
}
</script>