1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-16 01:55:07 +01:00
onion/js/third_party/notifications.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-09-04 11:49:55 +02:00
'use strict';
import history from '../history';
import { altThirdParty } from '../alt';
2015-09-04 11:49:55 +02:00
import EventActions from '../actions/event_actions';
import NotificationActions from '../actions/notification_actions';
import { getSubdomain } from '../utils/general_utils';
2015-09-04 11:49:55 +02:00
class NotificationsHandler {
constructor() {
this.bindActions(EventActions);
this.loaded = false;
}
onProfileDidLoad() {
2015-09-04 11:49:55 +02:00
if (this.loaded) {
return;
}
let subdomain = getSubdomain();
2015-09-04 11:49:55 +02:00
if (subdomain === 'ikonotv') {
NotificationActions.fetchContractAgreementListNotifications().then(
(res) => {
if (res.notifications && res.notifications.length > 0) {
this.loaded = true;
console.log('Contractagreement notifications loaded');
2015-10-01 15:57:46 +02:00
history.pushState(null, '/contract_notifications');
2015-09-04 11:49:55 +02:00
}
}
);
}
this.loaded = true;
}
}
export default altThirdParty.createStore(NotificationsHandler, 'NotificationsHandler');