Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlog committed Dec 26, 2019
1 parent 3a43db7 commit e76c7e0
Showing 1 changed file with 14 additions and 26 deletions.
40 changes: 14 additions & 26 deletions x-pack/plugins/endpoint/public/applications/endpoint/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ import * as React from 'react';
import ReactDOM from 'react-dom';
import { CoreStart, AppMountParameters } from 'kibana/public';
import { I18nProvider, FormattedMessage } from '@kbn/i18n/react';
import { History, createBrowserHistory, createHashHistory } from 'history';
import { History, createHashHistory } from 'history';
import { Route, Router, Switch } from 'react-router-dom';

/**
* This module will be loaded asynchronously to reduce the bundle size of your plugin's main bundle.
*/
export function renderApp(coreStart: CoreStart, { appBasePath, element }: AppMountParameters) {
export function renderApp(coreStart: CoreStart, { element }: AppMountParameters) {
coreStart.http.get('/api/endpoint/hello-world');

const history = createHashHistory();
// const history = createBrowserHistory({ basename: appBasePath })
ReactDOM.render(<AppRoot history={history} />, element);
const history = createHashHistory()
ReactDOM.render(<AppRoot history={history}/>, element);

return () => {
ReactDOM.unmountComponentAtNode(element);
Expand All @@ -30,33 +29,22 @@ interface RouterProps {
history: History;
}

const AppRoot: React.FC<RouterProps> = React.memo(({ history }) => (
const AppRoot: React.FC<RouterProps> = React.memo(({history}) => (
<I18nProvider>
<Router history={history}>
<Switch>
<Route
exact
path="/"
render={() => (
<Router history={history}>
<Switch>
<Route exact path="/" render={() => (
<h1 data-test-subj="welcomeTitle">
<FormattedMessage id="xpack.endpoint.welcomeTitle" defaultMessage="Hello World" />
</h1>
)}
/>
<Route
path="/management"
render={() => (
<h1 data-test-subj="management">
)} />
<Route path="/management" render={() => (
<h1 data-test-subj="management ">
<FormattedMessage id="xpack.endpoint.management" defaultMessage="Manage Endpoints" />
</h1>
)}
/>
<Route
render={() => (
<FormattedMessage id="xpack.endpoint.notFound" defaultMessage="Page Not Found" />
)}
/>
</Switch>
)} />
<Route render={() => <FormattedMessage id="xpack.endpoint.notFound" defaultMessage="Page Not Found" />} />
</Switch>
</Router>
</I18nProvider>
));

0 comments on commit e76c7e0

Please sign in to comment.