-
Notifications
You must be signed in to change notification settings - Fork 47
/
index.tsx
63 lines (54 loc) · 2.17 KB
/
index.tsx
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Import external components refrence
import 'reflect-metadata';
import './socialEngine';
import './styles/app.css';
import 'simplebar-react/dist/simplebar.min.css';
import i18n from 'locales/i18n';
import 'typeface-roboto';
import { BrowserRouter } from 'react-router-dom';
import { createRoot } from 'react-dom/client';
import { I18nextProvider } from 'react-i18next';
import { Provider } from 'react-redux';
import * as authorizeActions from 'redux/actions/authorizeActions';
import * as userSettingActions from 'redux/actions/userSettingActions';
import * as globalActions from 'redux/actions/globalActions';
import { store, runSaga } from 'redux/store';
import rootSaga from 'redux/sagas/rootSaga';
import App from 'App';
import { AuthProvider } from 'contexts/JWTContext';
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
import reportWebVitals from './reportWebVitals';
// import 'moment/locale/es'
/**
* Execute startup functions
*/
runSaga(rootSaga);
// Set user current language from cookie
store.dispatch(userSettingActions.SetCurrentLangFromCookie());
// Set default data
// tslint:disable-next-line:no-empty
store.subscribe(() => {});
store.dispatch(authorizeActions.asyncSetUserLogin());
// - Initialize languages
store.dispatch(globalActions.initLocale());
const container = document.getElementById('app') as HTMLElement;
const root = createRoot(container!);
root.render(
<Provider store={store}>
<I18nextProvider i18n={i18n}>
<BrowserRouter>
<AuthProvider>
<App />
</AuthProvider>
</BrowserRouter>
</I18nextProvider>
</Provider>,
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://cra.link/PWA
serviceWorkerRegistration.register();
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();