-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
58 lines (51 loc) · 1.53 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
import "@project/shared";
import { Formio, initAuth, logout, Templates } from "@tsed/react-formio";
import tailwind from "@tsed/tailwind-formio";
import { ConnectedRouter } from "connected-react-router";
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { ToastContainer } from "./toastr/toastr.util";
import App from "./App";
import { Config } from "./config";
import reportWebVitals from "./reportWebVitals";
import configureStore, { history } from "./store";
import "./styles.css";
const store = configureStore({});
// Formio configuration
Formio.setProjectUrl(Config.formioUrl);
Formio.setBaseUrl(Config.formioUrl);
Formio.registerPlugin(
{
priority: 0,
wrapRequestPromise(promise: Promise<any>) {
return promise.catch((er) => {
if (er === "Unauthorized") {
store.dispatch(logout());
}
throw er;
});
}
},
"connectStore"
);
Formio.use(tailwind);
Templates.framework = "tailwind";
store.dispatch(initAuth() as any);
ReactDOM.render(
<React.StrictMode>
<Provider store={store}>
<div>
<ConnectedRouter history={history}>
<App />
</ConnectedRouter>
<ToastContainer />
</div>
</Provider>
</React.StrictMode>,
document.getElementById("root")
);
// 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();