Fix tslint issues

This commit is contained in:
Jannis Mattheis 2018-08-24 20:26:40 +02:00
parent f914f50c87
commit 22fc8c8018
7 changed files with 18 additions and 18 deletions

View File

@ -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');
});
}

View File

@ -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';

View File

@ -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',

View File

@ -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() {

View File

@ -10,7 +10,7 @@ import Message from '../component/Message';
import AppStore from '../stores/AppStore';
import MessageStore from '../stores/MessageStore';
interface IProps extends RouteComponentProps<any> {}
interface IProps extends RouteComponentProps<{id: string}> {}
interface IState {
appId: number;

View File

@ -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

View File

@ -2,6 +2,7 @@ import {Dispatcher} from 'flux';
export interface IEvent {
type: string;
// tslint:disable-next-line
payload?: any;
}