/* * Copyright 2020 EPAM Systems * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import React from "react"; import ReactDOM from "react-dom"; import singleSpaReact from "single-spa-react"; import { BrowserRouter, Route } from "react-router-dom"; import axios from "axios"; import { Agent, Group } from "pages"; import { agentDashboardPath, groupDashboardPath } from "admin-routes"; import { SetPanelContext, FilterContextProvider } from "common"; import { AgentHud as Test2CodeAgentHUD, GroupHudProps, ServiceGroupHud as Test2CodeServiceGroupHUD } from "./hud"; import pkj from "../package.json"; import "./index.css"; import { ResultFilterContextProvider } from "./common/contexts/result-filter-context"; console.log("Test2Code-UI version: ", pkj.version); axios.defaults.baseURL = process.env.REACT_APP_API_HOST ? `http://${process.env.REACT_APP_API_HOST}/api` : "/api"; axios.interceptors.request.use( (config) => { const token = localStorage.getItem("auth_token"); if (token) { // eslint-disable-next-line no-param-reassign config.headers.Authorization = `Bearer ${token}`; } return config; }, (error) => Promise.reject(error), ); const ErrorBoundary = (err: Error, info: React.ErrorInfo, props: any) => (