summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/index.js
blob: d40d17a205e219d0a829d3e866acb2f52d29eac2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react'
import ReactDOM from 'react-dom'
import * as Sentry from '@sentry/react'
import { Integrations } from '@sentry/tracing'
import { Provider } from 'react-redux'
import { setupSocketConnection } from './api/socket'
import './index.scss'
import Routes from './routes'
import config from './config'
import configureStore from './store/configure-store'

setupSocketConnection(() => {
    const store = configureStore()

    // Initialize Sentry if the user has configured a DSN
    const dsn = config['SENTRY_DSN']
    if (dsn) {
        Sentry.init({
            environment: process.env.NODE_ENV,
            dsn: dsn,
            integrations: [new Integrations.BrowserTracing()],
            tracesSampleRate: 0.1,
        })
    }

    ReactDOM.render(
        <Provider store={store}>
            <Routes />
        </Provider>,
        document.getElementById('root')
    )
})