pcpuma_unam_operador/components/botones/BotonFinSemestre.vue
2023-01-17 11:44:41 -06:00

51 lines
1.2 KiB
Vue

<template>
<b-field>
<b-button
type="is-warning"
label="Desactivar cuentas"
@click="
$alertsGenericos.imprimirWarning(
$buefy,
'¿Estas segur@ de querer deshabilitar las cuentas de todos los usuarios?',
desactivarCuentas
)
"
expanded
/>
</b-field>
</template>
<script>
import axios from 'axios'
export default {
props: {
updateIsLoading: { type: Function, required: true, default: () => {} },
admin: { type: Object, required: true, default: () => ({}) },
},
methods: {
desactivarCuentas() {
this.updateIsLoading(true)
return axios
.put(
`${process.env.api}/institucion-usuario/desactivar-cuentas`,
{},
this.$getToken.token()
)
.then((res) => {
this.updateIsLoading(false)
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
})
.catch((err) => {
this.updateIsLoading(false)
this.$alertsGenericos.imprimirError(
this.$buefy,
this.$router,
err.response.data
)
})
},
},
}
</script>