2015-06-25 14:39:39 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import alt from '../alt';
|
|
|
|
import CoaFetcher from '../fetchers/coa_fetcher';
|
|
|
|
|
|
|
|
|
|
|
|
class CoaActions {
|
|
|
|
constructor() {
|
|
|
|
this.generateActions(
|
|
|
|
'updateCoa'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchOne(id) {
|
|
|
|
CoaFetcher.fetchOne(id)
|
|
|
|
.then((res) => {
|
|
|
|
this.actions.updateCoa(res.coa);
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
2015-07-17 15:41:09 +02:00
|
|
|
console.logGlobal(err);
|
2015-06-25 14:39:39 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
create(edition) {
|
|
|
|
CoaFetcher.create(edition.bitcoin_id)
|
|
|
|
.then((res) => {
|
|
|
|
this.actions.updateCoa(res.coa);
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
2015-07-17 15:41:09 +02:00
|
|
|
console.logGlobal(err);
|
2015-06-25 14:39:39 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default alt.createActions(CoaActions);
|