Beispiel #1
0
 componentDidMount() {
   this.loadUser();
   const {
     pathname,
   } = this.props.location;
   updatePageTitle(getTitleFromRoute(pathname));
   this.handleSetMobile();
   if (window) {
     window.addEventListener('resize', this.handleSetMobile);
     window.addEventListener('online', this.handleOffline);
     window.addEventListener('offline', this.handleOffline);
   }
 }
Beispiel #2
0
 componentWillReceiveProps(newProps) {
   const {
     pathname,
   } = this.props.location;
   const newPathname = newProps.location.pathname;
   if (newPathname !== pathname) {
     updatePageTitle(getTitleFromRoute(newPathname));
   }
   const {
     isOffline,
   } = newProps;
   if (isOffline !== this.props.isOffline) {
     if (isOffline) {
       this.props.actions.appSetError(
         'Warning, the app is now offline.'
       );
     } else {
       this.props.actions.appSetMessage(
         'The app is now back online!'
       );
     }
   }
 }