2019-03-16 11:33:15 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import ReactDOM from "react-dom";
|
|
|
|
|
import { Provider } from "react-redux";
|
|
|
|
|
import "./index.css";
|
|
|
|
|
import App from "./App";
|
|
|
|
|
import Editor from "./pages/Editor";
|
2019-09-02 14:50:01 +00:00
|
|
|
import PageNotFound from "./pages/common/PageNotFound";
|
|
|
|
|
import LoginPage from "./pages/common/LoginPage";
|
2019-10-31 08:36:04 +00:00
|
|
|
import AppViewer from "./pages/AppViewer";
|
2019-03-16 11:33:15 +00:00
|
|
|
import * as serviceWorker from "./serviceWorker";
|
2019-10-25 05:35:20 +00:00
|
|
|
import { Router, Route, Switch } from "react-router-dom";
|
2019-03-26 15:28:24 +00:00
|
|
|
import { createStore, applyMiddleware } from "redux";
|
2019-10-25 05:35:20 +00:00
|
|
|
import history from "./utils/history";
|
2019-03-16 11:33:15 +00:00
|
|
|
import appReducer from "./reducers";
|
|
|
|
|
import { ThemeProvider, theme } from "./constants/DefaultTheme";
|
2019-09-09 10:30:22 +00:00
|
|
|
import createSagaMiddleware from "redux-saga";
|
|
|
|
|
import { rootSaga } from "./sagas";
|
|
|
|
|
import { DndProvider } from "react-dnd";
|
2019-10-09 09:08:55 +00:00
|
|
|
// import TouchBackend from "react-dnd-touch-backend";
|
|
|
|
|
import HTML5Backend from "react-dnd-html5-backend";
|
2019-08-30 10:33:49 +00:00
|
|
|
import { appInitializer } from "./utils/AppsmithUtils";
|
2019-09-10 11:01:48 +00:00
|
|
|
import ProtectedRoute from "./pages/common/ProtectedRoute";
|
2019-09-18 10:19:50 +00:00
|
|
|
import { composeWithDevTools } from "redux-devtools-extension/logOnlyInProduction";
|
2019-10-31 08:36:04 +00:00
|
|
|
import {
|
|
|
|
|
BASE_URL,
|
|
|
|
|
BUILDER_URL,
|
|
|
|
|
LOGIN_URL,
|
|
|
|
|
APP_VIEW_URL,
|
|
|
|
|
} from "./constants/routes";
|
2019-09-05 17:47:50 +00:00
|
|
|
|
2019-09-02 15:36:24 +00:00
|
|
|
appInitializer();
|
2019-09-09 10:30:22 +00:00
|
|
|
const sagaMiddleware = createSagaMiddleware();
|
2019-09-18 10:19:50 +00:00
|
|
|
const store = createStore(
|
|
|
|
|
appReducer,
|
|
|
|
|
composeWithDevTools(applyMiddleware(sagaMiddleware)),
|
|
|
|
|
);
|
2019-09-09 10:30:22 +00:00
|
|
|
sagaMiddleware.run(rootSaga);
|
2019-02-07 05:07:09 +00:00
|
|
|
ReactDOM.render(
|
2019-10-09 09:08:55 +00:00
|
|
|
<DndProvider backend={HTML5Backend}>
|
2019-08-26 12:41:21 +00:00
|
|
|
<Provider store={store}>
|
|
|
|
|
<ThemeProvider theme={theme}>
|
2019-10-25 05:35:20 +00:00
|
|
|
<Router history={history}>
|
2019-08-26 12:41:21 +00:00
|
|
|
<Switch>
|
2019-10-18 08:16:26 +00:00
|
|
|
<Route exact path={BASE_URL} component={App} />
|
|
|
|
|
<ProtectedRoute path={BUILDER_URL} component={Editor} />
|
2019-10-31 08:36:04 +00:00
|
|
|
<ProtectedRoute path={APP_VIEW_URL} component={AppViewer} />
|
2019-10-18 08:16:26 +00:00
|
|
|
<Route exact path={LOGIN_URL} component={LoginPage} />
|
2019-08-26 12:41:21 +00:00
|
|
|
<Route component={PageNotFound} />
|
|
|
|
|
</Switch>
|
2019-10-25 05:35:20 +00:00
|
|
|
</Router>
|
2019-08-26 12:41:21 +00:00
|
|
|
</ThemeProvider>
|
|
|
|
|
</Provider>
|
|
|
|
|
</DndProvider>,
|
2019-09-09 10:30:22 +00:00
|
|
|
document.getElementById("root"),
|
2019-03-16 11:33:15 +00:00
|
|
|
);
|
2019-01-21 15:11:10 +00:00
|
|
|
|
|
|
|
|
// 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: http://bit.ly/CRA-PWA
|
2019-03-16 11:33:15 +00:00
|
|
|
serviceWorker.unregister();
|