import { observable, action, computed } from 'mobx';
export default class DepositStore {
  @observable isLoading = false;
  @observable depositData = [];
  @observable bank = {};
  @observable bankAdmin = {
    name : '',
    account_number : '',
    on_behalf : '',
  };
  @observable data = {
    payment_proof: '',
    amount: '',
    bank_account_number: '',
    bank_name: '',
    bank_behalf_of: '',
    bank_to: {
      name: this.bankAdmin.name,
      account_number: this.bankAdmin.account_number,
      on_behalf: this.bankAdmin.on_behalf,
    },
  };
  @observable file = '';

  constructor(context) {
    this.context = context;
    this.http = context.http;
  }

  @action createDeposit() {
    this.isLoading = true;
    return this.http.post("deposit/create", this.data)
      .then(res => {
        this.isLoading = false;
        return res;
      })
      .catch(err => {
        this.isLoading = false;
        throw err;
      })
  }

  @action
  checkDeposit(){
    return this.http.get("deposit").then(res=>{
      this.depositData = res;
    })

  }


}
