2015-09-03 14:15:00 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-06 16:47:59 +02:00
|
|
|
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-12-14 18:34:27 +01:00
|
|
|
'flushPieceListNotifications',
|
2015-09-03 15:17:12 +02:00
|
|
|
'updateEditionListNotifications',
|
2015-12-14 18:34:27 +01:00
|
|
|
'flushEditionListNotifications',
|
2015-09-04 11:49:55 +02:00
|
|
|
'updatePieceNotifications',
|
2015-12-16 10:24:44 +01:00
|
|
|
'updateEditionNotifications',
|
2015-12-14 18:34:27 +01:00
|
|
|
'updateContractAgreementListNotifications',
|
|
|
|
'flushContractAgreementListNotifications'
|
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);
|