2015-08-05 14:40:26 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-06 16:47:59 +02:00
|
|
|
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(
|
2015-08-07 11:27:44 +02:00
|
|
|
'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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2015-08-07 11:27:44 +02:00
|
|
|
|
|
|
|
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);
|