Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3364 | Rev 3451 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3364 Rev 3407
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react'
2
import { connect } from 'react-redux'
2
import { connect } from 'react-redux'
Línea 3... Línea 3...
3
 
3
 
4
import { addNotification } from '@app/redux/notification/notification.actions'
-
 
Línea 5... Línea 4...
5
import { logout } from '@app/redux/auth/auth.actions'
4
import { addNotification } from '@app/redux/notification/notification.actions'
6
 
5
 
7
class ErrorBoundary extends React.Component {
6
class ErrorBoundary extends React.Component {
8
  constructor(props) {
7
  constructor(props) {
Línea 14... Línea 13...
14
    return { hasError: true }
13
    return { hasError: true }
15
  }
14
  }
Línea 16... Línea 15...
16
 
15
 
17
  componentDidCatch(error, errorInfo) {
16
  componentDidCatch(error, errorInfo) {
18
    console.error('ErrorBoundary caught an error: ', error, errorInfo)
17
    console.error('ErrorBoundary caught an error: ', error, errorInfo)
-
 
18
    this.props.addNotification({
-
 
19
      style: 'danger',
-
 
20
      msg: 'Ha ocurrido un error en el inicio de sesión'
19
    this.props.addNotification({ style: 'danger', msg: error.message })
21
    })
-
 
22
    if (error.message.includes('sesión')) {
-
 
23
      window.localStorage.removeItem('jwt')
-
 
24
      window.location.reload()
20
    if (error.message.includes('sesión')) this.props.logout()
25
    }
Línea 21... Línea 26...
21
  }
26
  }
22
 
27
 
23
  render() {
28
  render() {
24
    return this.props.children
29
    return this.props.children
Línea 25... Línea 30...
25
  }
30
  }
26
}
31
}
27
 
-
 
28
const mapDispatchToProps = {
32
 
Línea 29... Línea 33...
29
  addNotification: (notification) => addNotification(notification),
33
const mapDispatchToProps = {