2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-06 16:47:59 +02:00
|
|
|
import { alt } from '../alt';
|
2015-05-26 13:48:46 +02:00
|
|
|
import EditionFetcher from '../fetchers/edition_fetcher';
|
2015-05-26 13:48:00 +02:00
|
|
|
|
|
|
|
|
2015-05-26 13:48:46 +02:00
|
|
|
class EditionActions {
|
2015-05-26 13:48:00 +02:00
|
|
|
constructor() {
|
|
|
|
this.generateActions(
|
2015-10-19 15:29:57 +02:00
|
|
|
'updateEdition',
|
|
|
|
'editionFailed'
|
2015-05-26 13:48:00 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-05-26 13:48:46 +02:00
|
|
|
fetchOne(editionId) {
|
|
|
|
EditionFetcher.fetchOne(editionId)
|
2015-05-26 13:48:00 +02:00
|
|
|
.then((res) => {
|
2015-05-26 13:48:46 +02:00
|
|
|
this.actions.updateEdition(res.edition);
|
2015-05-26 13:48:00 +02:00
|
|
|
})
|
|
|
|
.catch((err) => {
|
2015-07-17 15:41:09 +02:00
|
|
|
console.logGlobal(err);
|
2015-10-19 15:29:57 +02:00
|
|
|
this.actions.editionFailed(err.json);
|
2015-05-26 13:48:00 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-26 13:48:46 +02:00
|
|
|
export default alt.createActions(EditionActions);
|