mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 09:35:10 +01:00
33 lines
758 B
JavaScript
33 lines
758 B
JavaScript
'use strict';
|
|
|
|
import { alt } from '../../../../alt';
|
|
import Q from 'q';
|
|
|
|
import PrizeFetcher from '../fetchers/prize_fetcher';
|
|
|
|
class PrizeActions {
|
|
constructor() {
|
|
this.generateActions(
|
|
'updatePrize'
|
|
);
|
|
}
|
|
|
|
fetchPrize() {
|
|
return Q.Promise((resolve, reject) => {
|
|
PrizeFetcher
|
|
.fetch()
|
|
.then((res) => {
|
|
this.actions.updatePrize({
|
|
prize: res.prize
|
|
});
|
|
resolve(res);
|
|
})
|
|
.catch((err) => {
|
|
console.logGlobal(err);
|
|
reject(err);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
export default alt.createActions(PrizeActions); |