1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-16 01:55:07 +01:00
onion/js/components/whitelabel/prize/actions/prize_jury_actions.js

76 lines
1.9 KiB
JavaScript
Raw Normal View History

2015-08-05 14:40:26 +02:00
'use strict';
import { alt } from '../../../../alt';
2015-08-05 14:40:26 +02:00
import Q from 'q';
import PrizeJuryFetcher from '../fetchers/prize_jury_fetcher';
class PrizeJuryActions {
constructor() {
this.generateActions(
'updatePrizeJury',
'removePrizeJury',
'activatePrizeJury'
2015-08-05 14:40:26 +02:00
);
}
fetchJury() {
return Q.Promise((resolve, reject) => {
PrizeJuryFetcher
.fetch()
.then((res) => {
this.actions.updatePrizeJury(res.members);
resolve(res);
})
.catch((err) => {
console.logGlobal(err);
reject(err);
});
});
}
activateJury(email) {
return Q.Promise((resolve, reject) => {
PrizeJuryFetcher
.activate(email)
.then((res) => {
resolve(res);
})
.catch((err) => {
console.logGlobal(err);
reject(err);
});
});
}
revokeJury(email) {
return Q.Promise((resolve, reject) => {
PrizeJuryFetcher
.delete(email)
.then((res) => {
this.actions.removePrizeJury(email);
resolve(res);
})
.catch((err) => {
console.logGlobal(err);
reject(err);
});
});
}
resendJuryInvitation(email) {
return Q.Promise((resolve, reject) => {
PrizeJuryFetcher
.resend(email)
.then((res) => {
resolve(res);
})
.catch((err) => {
console.logGlobal(err);
reject(err);
});
});
}
2015-08-05 14:40:26 +02:00
}
export default alt.createActions(PrizeJuryActions);