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

export default class Airlines {
    @observable airlines = [];
    @observable airlineData = {
        id: '',
        name: '',
        code: '',
        airline_type_id: '',
        image_path: '',
        created_at: '',
        updated_at: '',
        deleted_at: '',
    };

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

    @action
    getAirlines(){
        return this.http.get(`airline`).then(res => {
            this.airlines = res;
        })
    }

    @action
    getAirlineById(id){
        return this.http.get(`airline/${id}`).then(res => {
            this.airlineData = res;
        })
    }
}
