2015-09-04 11:49:55 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-05 11:52:23 +02:00
|
|
|
import history from '../history';
|
2015-10-06 16:47:59 +02:00
|
|
|
import { altThirdParty } from '../alt';
|
2015-10-06 16:50:51 +02:00
|
|
|
|
|
|
|
|
2015-09-04 11:49:55 +02:00
|
|
|
import EventActions from '../actions/event_actions';
|
|
|
|
|
|
|
|
import NotificationActions from '../actions/notification_actions';
|
|
|
|
|
2015-09-29 14:58:56 +02:00
|
|
|
import { getSubdomain } from '../utils/general_utils';
|
|
|
|
|
2015-09-04 11:49:55 +02:00
|
|
|
|
|
|
|
class NotificationsHandler {
|
|
|
|
constructor() {
|
|
|
|
this.bindActions(EventActions);
|
|
|
|
this.loaded = false;
|
|
|
|
}
|
|
|
|
|
2016-01-08 14:59:45 +01:00
|
|
|
onUserDidAuthenticate() {
|
2015-09-04 11:49:55 +02:00
|
|
|
if (this.loaded) {
|
|
|
|
return;
|
|
|
|
}
|
2015-10-05 11:52:23 +02:00
|
|
|
|
2016-01-08 14:59:45 +01:00
|
|
|
const subdomain = getSubdomain();
|
2015-09-04 11:49:55 +02:00
|
|
|
if (subdomain === 'ikonotv') {
|
|
|
|
NotificationActions.fetchContractAgreementListNotifications().then(
|
|
|
|
(res) => {
|
|
|
|
if (res.notifications && res.notifications.length > 0) {
|
|
|
|
console.log('Contractagreement notifications loaded');
|
2016-01-08 14:59:45 +01:00
|
|
|
this.loaded = true;
|
|
|
|
|
2016-01-11 17:52:32 +01:00
|
|
|
history.push('/contract_notifications');
|
2015-09-04 11:49:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
this.loaded = true;
|
|
|
|
}
|
2016-01-08 14:59:45 +01:00
|
|
|
|
|
|
|
onUserDidLogout() {
|
|
|
|
this.loaded = false;
|
|
|
|
}
|
2015-09-04 11:49:55 +02:00
|
|
|
}
|
|
|
|
|
2015-10-06 16:47:59 +02:00
|
|
|
export default altThirdParty.createStore(NotificationsHandler, 'NotificationsHandler');
|