pcpuma_unam_operador/components/botones/BotonFinSemestre.vue

51 lines
1.2 KiB
Vue
Raw Normal View History

<template>
<b-field>
<b-button
type="is-warning"
label="Desactivar cuentas"
@click="
$alertsGenericos.imprimirWarning(
$buefy,
2023-01-08 23:50:17 +00:00
'¿Estas segur@ de querer deshabilitar las cuentas de todos los usuarios?',
desactivarCuentas
)
"
expanded
/>
</b-field>
</template>
<script>
2023-01-08 23:50:17 +00:00
import axios from 'axios'
export default {
props: {
2022-08-14 22:23:01 +00:00
updateIsLoading: { type: Function, required: true, default: () => {} },
admin: { type: Object, required: true, default: () => ({}) },
},
methods: {
desactivarCuentas() {
this.updateIsLoading(true)
2022-12-05 15:36:30 +00:00
return axios
2023-01-08 23:50:17 +00:00
.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)
2022-08-05 23:41:37 +00:00
this.$alertsGenericos.imprimirError(
this.$buefy,
this.$router,
err.response.data
)
})
},
},
}
</script>