2015-09-03 14:15:00 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
2015-10-06 16:47:59 +02:00
|
|
|
import { alt } from '../alt';
|
2015-09-03 14:15:00 +02:00
|
|
|
|
|
|
|
import NotificationActions from '../actions/notification_actions';
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationStore {
|
|
|
|
constructor() {
|
|
|
|
this.pieceListNotifications = {};
|
|
|
|
this.editionListNotifications = {};
|
2015-12-14 18:34:27 +01:00
|
|
|
// Need to determine if contract agreement notifications have been loaded or not,
|
|
|
|
// so we use null here instead of an empty array
|
2015-09-07 12:03:59 +02:00
|
|
|
this.contractAgreementListNotifications = null;
|
2015-09-03 15:17:12 +02:00
|
|
|
this.editionNotifications = null;
|
|
|
|
this.pieceNotifications = null;
|
2015-09-03 14:15:00 +02:00
|
|
|
this.bindActions(NotificationActions);
|
|
|
|
}
|
|
|
|
|
|
|
|
onUpdatePieceListNotifications(res) {
|
|
|
|
this.pieceListNotifications = res.notifications;
|
|
|
|
}
|
|
|
|
|
2015-12-14 18:34:27 +01:00
|
|
|
onFlushPieceListNotifications() {
|
|
|
|
this.pieceListNotifications = [];
|
|
|
|
}
|
|
|
|
|
2015-09-03 15:17:12 +02:00
|
|
|
onUpdatePieceNotifications(res) {
|
|
|
|
this.pieceNotifications = res.notification;
|
|
|
|
}
|
|
|
|
|
2015-09-03 14:15:00 +02:00
|
|
|
onUpdateEditionListNotifications(res) {
|
|
|
|
this.editionListNotifications = res.notifications;
|
|
|
|
}
|
|
|
|
|
2015-09-03 15:17:12 +02:00
|
|
|
onUpdateEditionNotifications(res) {
|
|
|
|
this.editionNotifications = res.notification;
|
|
|
|
}
|
|
|
|
|
2015-09-04 11:49:55 +02:00
|
|
|
onUpdateContractAgreementListNotifications(res) {
|
|
|
|
this.contractAgreementListNotifications = res.notifications;
|
|
|
|
}
|
|
|
|
|
2015-12-14 18:34:27 +01:00
|
|
|
onFlushContractAgreementListNotifications() {
|
|
|
|
this.contractAgreementListNotifications = null;
|
|
|
|
}
|
2015-09-03 14:15:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default alt.createStore(NotificationStore, 'NotificationStore');
|