Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1562 | Rev 1606 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1197 stevensc 1
import React from 'react'
2
import { connect } from 'react-redux'
1202 stevensc 3
 
1565 stevensc 4
import { addNotification } from '@app/redux/notification/notification.actions'
1197 stevensc 5
 
6
class ErrorBoundary extends React.Component {
7
  componentDidCatch(error, errorInfo) {
8
    console.error('ErrorBoundary caught an error: ', error, errorInfo)
9
    this.props.addNotification({ style: 'danger', msg: error.message })
10
  }
11
 
12
  render() {
13
    return this.props.children
14
  }
15
}
16
 
17
const mapDispatchToProps = {
18
  addNotification: (notification) => addNotification(notification)
19
}
20
 
21
export default connect(null, mapDispatchToProps)(ErrorBoundary)