<template>
  <el-card class="box-card" style="width:800px;" size="small">
    <!-- <div slot="header" class="clearfix">
      <span>Security</span>
    </div> -->
    <div>
      <el-button type="danger" @click="handleReset">Reset Password</el-button>
    </div>
  </el-card>
</template>
<script>
import { resetPassword } from '@/api/admin'
export default {
  name: 'Account',
  props: {
    userId: { type: String, default: '' }
  },
  methods: {
    handleReset() {
      this.$confirm('Sure to reset password?', {
        type: 'warning',
        distinguishCancelAndClose: true,
        confirmButtonText: 'Ok',
        cancelButtonText: 'Cancel'
      })
        .then(() => {
          resetPassword(this.userId).then(res => {
            if (res.IsSuccess) {
              this.$message({
                message: 'Reset password successfully',
                type: 'success'
              })
            }
          })
        })
    }
  }
}
</script>
