2015-07-27 18:06:02 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-06 16:47:59 +02:00
|
|
|
import { altThirdParty } from '../alt';
|
2015-07-27 18:06:02 +02:00
|
|
|
import EventActions from '../actions/event_actions';
|
|
|
|
|
|
|
|
import Raven from 'raven-js';
|
|
|
|
|
|
|
|
|
|
|
|
class RavenHandler {
|
|
|
|
constructor() {
|
|
|
|
this.bindActions(EventActions);
|
|
|
|
this.loaded = false;
|
|
|
|
}
|
|
|
|
|
2016-01-08 14:59:45 +01:00
|
|
|
onUserDidAuthenticate(user) {
|
2015-07-27 18:06:02 +02:00
|
|
|
if (this.loaded) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Raven.setUserContext({
|
2016-01-08 14:59:45 +01:00
|
|
|
email: user.email
|
2015-07-27 18:06:02 +02:00
|
|
|
});
|
|
|
|
console.log('Raven loaded');
|
|
|
|
this.loaded = true;
|
|
|
|
}
|
2016-01-08 14:59:45 +01:00
|
|
|
|
|
|
|
onUserDidLogout() {
|
|
|
|
Raven.setUserContext();
|
|
|
|
this.loaded = false;
|
|
|
|
}
|
2015-07-27 18:06:02 +02:00
|
|
|
}
|
|
|
|
|
2015-10-06 16:47:59 +02:00
|
|
|
export default altThirdParty.createStore(RavenHandler, 'RavenHandler');
|