import { action, computed, extendObservable, observable } from 'mobx';

export default class Odoo {

  @observable isLoading = false;
  @observable data  = null;

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

  @action
  syncData(){
    this.isLoading = true;
    return this.http.get(`odoo/sync/d203f833-356a-45fc-ae99-d65e790e2a88`).then(res => {
      this.data = res;
      this.isLoading = false;
      return res;
    })
  }

  @action
  createSales(orderStoreId){
    this.isLoading = true;
    return this.http.post(`odoo/sales`,{
      user_order_store_id : orderStoreId
    }).then(res => {
      this.isLoading = false;
      return res;
    })
  }
}
