mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 09:35:10 +01:00
34 lines
834 B
JavaScript
34 lines
834 B
JavaScript
|
'use strict';
|
||
|
|
||
|
import alt from '../alt';
|
||
|
import Q from 'q';
|
||
|
|
||
|
import PrizeListFetcher from '../fetchers/prize_list_fetcher';
|
||
|
|
||
|
class PrizeListActions {
|
||
|
constructor() {
|
||
|
this.generateActions(
|
||
|
'updatePrizeList'
|
||
|
);
|
||
|
}
|
||
|
|
||
|
fetchPrizeList() {
|
||
|
return Q.Promise((resolve, reject) => {
|
||
|
PrizeListFetcher
|
||
|
.fetch()
|
||
|
.then((res) => {
|
||
|
this.actions.updatePrizeList({
|
||
|
prizeList: res.prizes,
|
||
|
prizeListCount: res.count
|
||
|
});
|
||
|
resolve(res);
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
console.logGlobal(err);
|
||
|
reject(err);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default alt.createActions(PrizeListActions);
|