pcpuma_unam_operador/components/botones/BotonUpdatePassword.vue

59 lines
1.3 KiB
Vue
Raw Normal View History

2022-07-29 01:04:17 +00:00
<template>
<b-field>
<b-button
type="is-link"
:disabled="!operador.activo"
@click="
$alertsGenericos.imprimirWarning(
$buefy,
2022-08-14 22:23:01 +00:00
`¿Estas segur@ de querer reenviar la contraseña de este ${campo}?`,
2022-07-29 01:04:17 +00:00
updatePassword
)
"
>
Reenviar Contraseña
</b-button>
</b-field>
</template>
<script>
import axios from 'axios'
export default {
props: {
2022-08-14 22:23:01 +00:00
updateIsLoading: { type: Function, required: true, default: () => {} },
operador: { type: Object, required: true, default: () => ({}) },
campo: { type: String, required: true, default: '' },
2022-07-29 01:04:17 +00:00
},
methods: {
updatePassword() {
const data = {
id_operador: this.operador.id_operador,
}
this.updateIsLoading(true)
axios
.put(
`${process.env.api}/operador/update-password`,
data,
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
)
2022-07-29 01:04:17 +00:00
})
},
},
}
</script>
<style></style>