2015-09-03 14:15:00 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import alt from '../alt';
|
2015-09-04 11:49:55 +02:00
|
|
|
import Q from 'q';
|
2015-09-03 14:15:00 +02:00
|
|
|
|
|
|
|
import NotificationFetcher from '../fetchers/notification_fetcher';
|
|
|
|
|
|
|
|
class NotificationActions {
|
|
|
|
constructor() {
|
|
|
|
this.generateActions(
|
|
|
|
'updatePieceListNotifications',
|
2015-09-03 15:17:12 +02:00
|
|
|
'updateEditionListNotifications',
|
|
|
|
'updateEditionNotifications',
|
2015-09-04 11:49:55 +02:00
|
|
|
'updatePieceNotifications',
|
|
|
|
'updateContractAgreementListNotifications'
|
2015-09-03 14:15:00 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchPieceListNotifications() {
|
|
|
|
NotificationFetcher
|
|
|
|
.fetchPieceListNotifications()
|
|
|
|
.then((res) => {
|
|
|
|
this.actions.updatePieceListNotifications(res);
|
|
|
|
})
|
|
|
|
.catch((err) => console.logGlobal(err));
|
|
|
|
}
|
|
|
|
|
2015-09-03 15:17:12 +02:00
|
|
|
fetchPieceNotifications(pieceId) {
|
|
|
|
NotificationFetcher
|
|
|
|
.fetchPieceNotifications(pieceId)
|
|
|
|
.then((res) => {
|
|
|
|
this.actions.updatePieceNotifications(res);
|
|
|
|
})
|
|
|
|
.catch((err) => console.logGlobal(err));
|
|
|
|
}
|
|
|
|
|
2015-09-03 14:15:00 +02:00
|
|
|
fetchEditionListNotifications() {
|
|
|
|
NotificationFetcher
|
|
|
|
.fetchEditionListNotifications()
|
|
|
|
.then((res) => {
|
|
|
|
this.actions.updateEditionListNotifications(res);
|
|
|
|
})
|
|
|
|
.catch((err) => console.logGlobal(err));
|
|
|
|
}
|
2015-09-03 15:17:12 +02:00
|
|
|
|
|
|
|
fetchEditionNotifications(editionId) {
|
|
|
|
NotificationFetcher
|
|
|
|
.fetchEditionNotifications(editionId)
|
|
|
|
.then((res) => {
|
|
|
|
this.actions.updateEditionNotifications(res);
|
|
|
|
})
|
|
|
|
.catch((err) => console.logGlobal(err));
|
|
|
|
}
|
2015-09-04 11:49:55 +02:00
|
|
|
|
|
|
|
fetchContractAgreementListNotifications() {
|
|
|
|
return Q.Promise((resolve, reject) => {
|
|
|
|
NotificationFetcher
|
|
|
|
.fetchContractAgreementListNotifications()
|
|
|
|
.then((res) => {
|
|
|
|
this.actions.updateContractAgreementListNotifications(res);
|
|
|
|
resolve(res);
|
|
|
|
})
|
|
|
|
.catch((err) => console.logGlobal(err));
|
|
|
|
});
|
|
|
|
}
|
2015-09-03 14:15:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default alt.createActions(NotificationActions);
|