-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathindex.jsx
63 lines (58 loc) · 2.47 KB
/
index.jsx
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
// Needed to add the below due to issues in IE11, see this thread
// https://github.com/facebook/create-react-app/issues/9906#issuecomment-720905753
/** @jsxRuntime classic */
import "react-app-polyfill/ie11";
import "react-app-polyfill/stable";
import { BacktraceClient, ErrorBoundary } from "@backtrace-labs/react";
import React from "react";
import ReactDOM from "react-dom";
import { Route, BrowserRouter as Router } from "react-router-dom";
import PrivateRoute from "./components/PrivateRoute";
import "./index.css";
import Cart from "./pages/Cart";
import CheckOutStepOne from "./pages/CheckOutStepOne";
import CheckOutStepTwo from "./pages/CheckOutStepTwo";
import Finish from "./pages/Finish";
import Inventory from "./pages/Inventory";
import InventoryItem from "./pages/InventoryItem";
import Login from "./pages/Login";
import * as serviceWorkerRegistration from "./serviceWorkerRegistration";
import { ROUTES } from "./utils/Constants";
import { currentUser } from "./utils/Credentials";
import { ShoppingCart } from "./utils/shopping-cart";
import { InventoryData } from "./utils/InventoryData.js";
import { InventoryDataLong } from "./utils/InventoryDataLong.js";
BacktraceClient.initialize({
name: "Swag Store",
version: "3.0.0",
url: "https://submit.backtrace.io/UNIVERSE/TOKEN/json",
userAttributes: () => ({
user: currentUser(),
shoppingCart: ShoppingCart.getCartContents(),
}),
});
const routing = (
<ErrorBoundary>
<Router>
<Route exact path={ROUTES.LOGIN} component={Login} />
<PrivateRoute path={ROUTES.INVENTORY} component={(props) => <Inventory data={InventoryData} {...props}/>} />
<PrivateRoute path={ROUTES.INVENTORY_LONG} component={(props) => <Inventory data={InventoryDataLong} {...props}/>} />
<PrivateRoute path={ROUTES.INVENTORY_LIST} component={InventoryItem} />
<PrivateRoute path={ROUTES.CART} component={Cart} />
<PrivateRoute
path={ROUTES.CHECKOUT_STEP_ONE}
component={CheckOutStepOne}
/>
<PrivateRoute
path={ROUTES.CHECKOUT_STEP_TWO}
component={CheckOutStepTwo}
/>
<PrivateRoute path={ROUTES.CHECKOUT_COMPLETE} component={Finish} />
</Router>
</ErrorBoundary>
);
ReactDOM.render(routing, document.getElementById("root"));
// 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();