diff --git a/ui/src/actions/UserAction.ts b/ui/src/actions/UserAction.ts index aa2a273..eb0e7d6 100644 --- a/ui/src/actions/UserAction.ts +++ b/ui/src/actions/UserAction.ts @@ -5,7 +5,6 @@ import ClientStore from '../stores/ClientStore'; import dispatcher from '../stores/dispatcher'; import {getToken, setAuthorizationToken} from './defaultAxios'; import * as GlobalAction from './GlobalAction'; -import {snack} from './GlobalAction'; /** * Login the user. @@ -25,7 +24,7 @@ export function login(username: string, password: string) { auth: {username, password}, }) .then((resp) => { - snack(`A client named '${name}' was created for your session.`); + GlobalAction.snack(`A client named '${name}' was created for your session.`); setAuthorizationToken(resp.data.token); tryAuthenticate() .then(GlobalAction.initialLoad) @@ -36,7 +35,7 @@ export function login(username: string, password: string) { ); }) .catch(() => { - snack('Login failed'); + GlobalAction.snack('Login failed'); noAuthentication(); }); } @@ -63,7 +62,9 @@ export function tryAuthenticate() { .catch((resp) => { if (getToken()) { setAuthorizationToken(null); - snack('Authentication failed, try to re-login. (client or user was deleted)'); + GlobalAction.snack( + 'Authentication failed, try to re-login. (client or user was deleted)' + ); } noAuthentication(); return Promise.reject(resp); @@ -95,7 +96,7 @@ function authenticating() { export function changeCurrentUser(pass: string) { axios .post(config.get('url') + 'current/user/password', {pass}) - .then(() => snack('Password changed')); + .then(() => GlobalAction.snack('Password changed')); } /** Fetches all users. */ @@ -113,7 +114,7 @@ export function deleteUser(id: number) { axios .delete(config.get('url') + 'user/' + id) .then(fetchUsers) - .then(() => snack('User deleted')); + .then(() => GlobalAction.snack('User deleted')); } /** @@ -126,7 +127,7 @@ export function createUser(name: string, pass: string, admin: boolean) { axios .post(config.get('url') + 'user', {name, pass, admin}) .then(fetchUsers) - .then(() => snack('User created')); + .then(() => GlobalAction.snack('User created')); } /** @@ -140,6 +141,6 @@ export function updateUser(id: number, name: string, pass: string | null, admin: axios.post(config.get('url') + 'user/' + id, {name, pass, admin}).then(() => { fetchUsers(); tryAuthenticate(); // try authenticate updates the current user - snack('User updated'); + GlobalAction.snack('User updated'); }); } diff --git a/ui/src/component/Header.tsx b/ui/src/component/Header.tsx index ad79fad..ca1f4dc 100644 --- a/ui/src/component/Header.tsx +++ b/ui/src/component/Header.tsx @@ -1,8 +1,7 @@ import AppBar from '@material-ui/core/AppBar'; import Button from '@material-ui/core/Button'; import IconButton from '@material-ui/core/IconButton'; -import {Theme, WithStyles} from '@material-ui/core/styles'; -import {withStyles} from '@material-ui/core/styles'; +import {Theme, WithStyles, withStyles} from '@material-ui/core/styles'; import Toolbar from '@material-ui/core/Toolbar'; import Typography from '@material-ui/core/Typography'; import AccountCircle from '@material-ui/icons/AccountCircle'; diff --git a/ui/src/component/Navigation.tsx b/ui/src/component/Navigation.tsx index 8b5c192..5965f53 100644 --- a/ui/src/component/Navigation.tsx +++ b/ui/src/component/Navigation.tsx @@ -2,20 +2,19 @@ import Divider from '@material-ui/core/Divider'; import Drawer from '@material-ui/core/Drawer'; import ListItem from '@material-ui/core/ListItem'; import ListItemText from '@material-ui/core/ListItemText'; -import {Theme, WithStyles} from '@material-ui/core/styles'; -import {withStyles} from '@material-ui/core/styles'; +import {StyleRules, Theme, WithStyles, withStyles} from '@material-ui/core/styles'; import React, {Component} from 'react'; import {Link} from 'react-router-dom'; import AppStore from '../stores/AppStore'; -const styles = (theme: Theme) => ({ +const styles = (theme: Theme): StyleRules<'drawerPaper' | 'toolbar' | 'link'> => ({ drawerPaper: { - position: 'relative' as 'relative', + position: 'relative', width: 250, minHeight: '100%', height: '100vh', }, - toolbar: theme.mixins.toolbar as any, + toolbar: theme.mixins.toolbar, link: { color: 'inherit', textDecoration: 'none', diff --git a/ui/src/pages/Applications.tsx b/ui/src/pages/Applications.tsx index 288a74b..fec9584 100644 --- a/ui/src/pages/Applications.tsx +++ b/ui/src/pages/Applications.tsx @@ -25,7 +25,7 @@ interface IState { class Applications extends Component<{}, IState> { public state = {apps: [], createDialog: false, deleteId: -1}; - private uploadId: number = -1; + private uploadId = -1; private upload: HTMLInputElement | null = null; public componentWillMount() { diff --git a/ui/src/pages/Messages.tsx b/ui/src/pages/Messages.tsx index dfa10ba..e57b4d9 100644 --- a/ui/src/pages/Messages.tsx +++ b/ui/src/pages/Messages.tsx @@ -10,7 +10,7 @@ import Message from '../component/Message'; import AppStore from '../stores/AppStore'; import MessageStore from '../stores/MessageStore'; -interface IProps extends RouteComponentProps {} +interface IProps extends RouteComponentProps<{id: string}> {} interface IState { appId: number; diff --git a/ui/src/registerServiceWorker.ts b/ui/src/registerServiceWorker.ts index dfc0e96..6b0242e 100644 --- a/ui/src/registerServiceWorker.ts +++ b/ui/src/registerServiceWorker.ts @@ -1,4 +1,4 @@ -// tslint:disable:no-console +// tslint:disable // In production, we register a service worker to serve assets from local cache. // This lets the app load faster on subsequent visits in production, and gives diff --git a/ui/src/stores/dispatcher.ts b/ui/src/stores/dispatcher.ts index 67bfd31..25acd16 100644 --- a/ui/src/stores/dispatcher.ts +++ b/ui/src/stores/dispatcher.ts @@ -2,6 +2,7 @@ import {Dispatcher} from 'flux'; export interface IEvent { type: string; + // tslint:disable-next-line payload?: any; }