Fixed compilation warnings and errors
This commit is contained in:
parent
0db537a718
commit
efe7f745fc
@ -1,21 +1,25 @@
|
|||||||
import * as History from "history";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { Menu } from "semantic-ui-react";
|
import { Menu } from "semantic-ui-react";
|
||||||
|
|
||||||
import { AppState, injectState } from "@app/state";
|
import { AppState, ConsumeState, injectState } from "@app/state";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
|
|
||||||
interface NavItemProps {
|
interface NavItemProps {
|
||||||
to: string;
|
to: string;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
location: History.Location;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
const NavItem = observer(({ to, children }: NavItemProps) => {
|
||||||
function NavItem({ to, children, location }: NavItemProps) {
|
function consumeState(appState: AppState) {
|
||||||
return <Menu.Item as={Link} to={to} active={location.pathname.startsWith(to)}>{children}</Menu.Item>;
|
const { location } = appState.routerStore;
|
||||||
}
|
return (
|
||||||
|
<Menu.Item as={Link} to={to} active={location.pathname.startsWith(to)}>{children}</Menu.Item>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (<ConsumeState>{consumeState}</ConsumeState>);
|
||||||
|
});
|
||||||
|
|
||||||
function NavBar({ appState }: { appState: AppState }) {
|
function NavBar({ appState }: { appState: AppState }) {
|
||||||
let loginMenu;
|
let loginMenu;
|
||||||
|
@ -2,8 +2,8 @@ import { WebSocketRpcClient } from "@app/sprinklersRpc/websocketClient";
|
|||||||
import HttpApi from "@app/state/HttpApi";
|
import HttpApi from "@app/state/HttpApi";
|
||||||
import { UiStore } from "@app/state/UiStore";
|
import { UiStore } from "@app/state/UiStore";
|
||||||
import { createBrowserHistory, History } from "history";
|
import { createBrowserHistory, History } from "history";
|
||||||
import { RouterStore, syncHistoryWithStore } from "mobx-react-router";
|
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
|
import { RouterStore, syncHistoryWithStore } from "mobx-react-router";
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV === "development";
|
const isDev = process.env.NODE_ENV === "development";
|
||||||
const websocketPort = isDev ? 8080 : location.port;
|
const websocketPort = isDev ? 8080 : location.port;
|
||||||
|
@ -61,7 +61,7 @@ export class TokenStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toJSON() {
|
toJSON() {
|
||||||
return { accessToken: this.accessToken.toJSON(), refreshToken: this.refreshToken.toJSON() }
|
return { accessToken: this.accessToken.toJSON(), refreshToken: this.refreshToken.toJSON() };
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFromJson(json: any) {
|
updateFromJson(json: any) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user