pcpuma_unam_operador/components/admin/Programas.vue
2022-12-05 09:36:30 -06:00

54 lines
1.2 KiB
Vue

<template>
<TablaProgramas
:programas="programas"
:total="programas.length"
:isLoadingTable="isLoadingTable"
:obtenerProgramas="obtenerProgramas"
:updateIsLoading="updateIsLoading"
/>
</template>
<script>
import axios from 'axios'
import TablaProgramas from '@/components/tablas/TablaProgramas'
export default {
components: { TablaProgramas },
props: {
updateIsLoading: { type: Function, required: true },
idInstitucion: { type: Number, required: true, default: false },
},
data() {
return {
programas: [],
isLoadingTable: false,
}
},
methods: {
obtenerProgramas() {
this.isLoadingTable = true
return axios
.get(
`${process.env.api}/institucion-programa/programas?id_institucion=${this.idInstitucion}`,
this.$getToken.token()
)
.then((res) => {
this.programas = res.data
this.isLoadingTable = false
})
.catch((err) => {
this.isLoadingTable = false
this.$alertsGenericos.imprimirError(
this.$buefy,
this.$router,
err.response.data
)
})
},
},
created() {
this.obtenerProgramas()
},
}
</script>