<template>
  <div class="edit-password">
    <div class="form-group">
      <label>{{$t('setting.newPassword')}}</label>
      <input type="password" required v-model="form.password" class="form-control" :placeholder="$t('setting.enterNewPassword')" />
    </div>
    <div class="form-group">
      <label>{{$t('setting.confirmPassword')}}</label>
      <input type="password" v-model="form.password_confirmation" required class="form-control" :placeholder="$t('setting.pleaseConfirmPassword')" />
    </div>
    <div class="text-center">
      <button type="button" class="btn w-25 btn-secondary" @click="$emit('close')">{{$t('common.cancelBtn')}}</button>
      <button type="button" class="btn w-25 btn-primary" @click="setPassword">{{$t('common.confirmBtn')}}</button>
    </div>
  </div>
</template>

<script>
import Member from "@/api/member";
import Setting from "../../api/setting";
export default {
  props: ["detail"],
  data() {
    return {
      form: {
        password: "",
        password_confirmation: ""
      }
    };
  },
  methods: {
    setPassword() {
      let data = this.form;
      if (utils.validate(".edit-password")) {
        Setting.withdrawalPassword(data).then(res => {
            this.$message.success(this.$t('setting.changeSuccess'));
            this.$emit("close");
          }).catch(err => {});
      }
    }
  },
  activated() {}
};
</script>

<style>
</style>