From efe7f745fcdfed28dbcf2e8b7fd5b28e8cac7543 Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Sun, 8 Jul 2018 07:16:17 -0600 Subject: [PATCH] Fixed compilation warnings and errors --- app/components/NavBar.tsx | 18 +++++++++++------- app/state/AppState.ts | 2 +- app/state/TokenStore.ts | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/components/NavBar.tsx b/app/components/NavBar.tsx index 1ef3c80..f0c684d 100644 --- a/app/components/NavBar.tsx +++ b/app/components/NavBar.tsx @@ -1,21 +1,25 @@ -import * as History from "history"; import * as React from "react"; import { Link } from "react-router-dom"; import { Menu } from "semantic-ui-react"; -import { AppState, injectState } from "@app/state"; +import { AppState, ConsumeState, injectState } from "@app/state"; import { observer } from "mobx-react"; interface NavItemProps { to: string; children: React.ReactNode; - location: History.Location; } -@observer -function NavItem({ to, children, location }: NavItemProps) { - return {children}; -} +const NavItem = observer(({ to, children }: NavItemProps) => { + function consumeState(appState: AppState) { + const { location } = appState.routerStore; + return ( + {children} + ); + } + + return ({consumeState}); +}); function NavBar({ appState }: { appState: AppState }) { let loginMenu; diff --git a/app/state/AppState.ts b/app/state/AppState.ts index d739ae2..c770e03 100644 --- a/app/state/AppState.ts +++ b/app/state/AppState.ts @@ -2,8 +2,8 @@ import { WebSocketRpcClient } from "@app/sprinklersRpc/websocketClient"; import HttpApi from "@app/state/HttpApi"; import { UiStore } from "@app/state/UiStore"; import { createBrowserHistory, History } from "history"; -import { RouterStore, syncHistoryWithStore } from "mobx-react-router"; import { computed } from "mobx"; +import { RouterStore, syncHistoryWithStore } from "mobx-react-router"; const isDev = process.env.NODE_ENV === "development"; const websocketPort = isDev ? 8080 : location.port; diff --git a/app/state/TokenStore.ts b/app/state/TokenStore.ts index 1cd0f83..fff44cc 100644 --- a/app/state/TokenStore.ts +++ b/app/state/TokenStore.ts @@ -61,7 +61,7 @@ export class TokenStore { } toJSON() { - return { accessToken: this.accessToken.toJSON(), refreshToken: this.refreshToken.toJSON() } + return { accessToken: this.accessToken.toJSON(), refreshToken: this.refreshToken.toJSON() }; } updateFromJson(json: any) {