Fix tslint issues
This commit is contained in:
parent
f914f50c87
commit
22fc8c8018
|
|
@ -5,7 +5,6 @@ import ClientStore from '../stores/ClientStore';
|
||||||
import dispatcher from '../stores/dispatcher';
|
import dispatcher from '../stores/dispatcher';
|
||||||
import {getToken, setAuthorizationToken} from './defaultAxios';
|
import {getToken, setAuthorizationToken} from './defaultAxios';
|
||||||
import * as GlobalAction from './GlobalAction';
|
import * as GlobalAction from './GlobalAction';
|
||||||
import {snack} from './GlobalAction';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Login the user.
|
* Login the user.
|
||||||
|
|
@ -25,7 +24,7 @@ export function login(username: string, password: string) {
|
||||||
auth: {username, password},
|
auth: {username, password},
|
||||||
})
|
})
|
||||||
.then((resp) => {
|
.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);
|
setAuthorizationToken(resp.data.token);
|
||||||
tryAuthenticate()
|
tryAuthenticate()
|
||||||
.then(GlobalAction.initialLoad)
|
.then(GlobalAction.initialLoad)
|
||||||
|
|
@ -36,7 +35,7 @@ export function login(username: string, password: string) {
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
snack('Login failed');
|
GlobalAction.snack('Login failed');
|
||||||
noAuthentication();
|
noAuthentication();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +62,9 @@ export function tryAuthenticate() {
|
||||||
.catch((resp) => {
|
.catch((resp) => {
|
||||||
if (getToken()) {
|
if (getToken()) {
|
||||||
setAuthorizationToken(null);
|
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();
|
noAuthentication();
|
||||||
return Promise.reject(resp);
|
return Promise.reject(resp);
|
||||||
|
|
@ -95,7 +96,7 @@ function authenticating() {
|
||||||
export function changeCurrentUser(pass: string) {
|
export function changeCurrentUser(pass: string) {
|
||||||
axios
|
axios
|
||||||
.post(config.get('url') + 'current/user/password', {pass})
|
.post(config.get('url') + 'current/user/password', {pass})
|
||||||
.then(() => snack('Password changed'));
|
.then(() => GlobalAction.snack('Password changed'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Fetches all users. */
|
/** Fetches all users. */
|
||||||
|
|
@ -113,7 +114,7 @@ export function deleteUser(id: number) {
|
||||||
axios
|
axios
|
||||||
.delete(config.get('url') + 'user/' + id)
|
.delete(config.get('url') + 'user/' + id)
|
||||||
.then(fetchUsers)
|
.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
|
axios
|
||||||
.post(config.get('url') + 'user', {name, pass, admin})
|
.post(config.get('url') + 'user', {name, pass, admin})
|
||||||
.then(fetchUsers)
|
.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(() => {
|
axios.post(config.get('url') + 'user/' + id, {name, pass, admin}).then(() => {
|
||||||
fetchUsers();
|
fetchUsers();
|
||||||
tryAuthenticate(); // try authenticate updates the current user
|
tryAuthenticate(); // try authenticate updates the current user
|
||||||
snack('User updated');
|
GlobalAction.snack('User updated');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import AppBar from '@material-ui/core/AppBar';
|
import AppBar from '@material-ui/core/AppBar';
|
||||||
import Button from '@material-ui/core/Button';
|
import Button from '@material-ui/core/Button';
|
||||||
import IconButton from '@material-ui/core/IconButton';
|
import IconButton from '@material-ui/core/IconButton';
|
||||||
import {Theme, WithStyles} from '@material-ui/core/styles';
|
import {Theme, WithStyles, withStyles} from '@material-ui/core/styles';
|
||||||
import {withStyles} from '@material-ui/core/styles';
|
|
||||||
import Toolbar from '@material-ui/core/Toolbar';
|
import Toolbar from '@material-ui/core/Toolbar';
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import AccountCircle from '@material-ui/icons/AccountCircle';
|
import AccountCircle from '@material-ui/icons/AccountCircle';
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,19 @@ import Divider from '@material-ui/core/Divider';
|
||||||
import Drawer from '@material-ui/core/Drawer';
|
import Drawer from '@material-ui/core/Drawer';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
import ListItemText from '@material-ui/core/ListItemText';
|
import ListItemText from '@material-ui/core/ListItemText';
|
||||||
import {Theme, WithStyles} from '@material-ui/core/styles';
|
import {StyleRules, Theme, WithStyles, withStyles} from '@material-ui/core/styles';
|
||||||
import {withStyles} from '@material-ui/core/styles';
|
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Link} from 'react-router-dom';
|
import {Link} from 'react-router-dom';
|
||||||
import AppStore from '../stores/AppStore';
|
import AppStore from '../stores/AppStore';
|
||||||
|
|
||||||
const styles = (theme: Theme) => ({
|
const styles = (theme: Theme): StyleRules<'drawerPaper' | 'toolbar' | 'link'> => ({
|
||||||
drawerPaper: {
|
drawerPaper: {
|
||||||
position: 'relative' as 'relative',
|
position: 'relative',
|
||||||
width: 250,
|
width: 250,
|
||||||
minHeight: '100%',
|
minHeight: '100%',
|
||||||
height: '100vh',
|
height: '100vh',
|
||||||
},
|
},
|
||||||
toolbar: theme.mixins.toolbar as any,
|
toolbar: theme.mixins.toolbar,
|
||||||
link: {
|
link: {
|
||||||
color: 'inherit',
|
color: 'inherit',
|
||||||
textDecoration: 'none',
|
textDecoration: 'none',
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ interface IState {
|
||||||
|
|
||||||
class Applications extends Component<{}, IState> {
|
class Applications extends Component<{}, IState> {
|
||||||
public state = {apps: [], createDialog: false, deleteId: -1};
|
public state = {apps: [], createDialog: false, deleteId: -1};
|
||||||
private uploadId: number = -1;
|
private uploadId = -1;
|
||||||
private upload: HTMLInputElement | null = null;
|
private upload: HTMLInputElement | null = null;
|
||||||
|
|
||||||
public componentWillMount() {
|
public componentWillMount() {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import Message from '../component/Message';
|
||||||
import AppStore from '../stores/AppStore';
|
import AppStore from '../stores/AppStore';
|
||||||
import MessageStore from '../stores/MessageStore';
|
import MessageStore from '../stores/MessageStore';
|
||||||
|
|
||||||
interface IProps extends RouteComponentProps<any> {}
|
interface IProps extends RouteComponentProps<{id: string}> {}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
appId: number;
|
appId: number;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// tslint:disable:no-console
|
// tslint:disable
|
||||||
// In production, we register a service worker to serve assets from local cache.
|
// 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
|
// This lets the app load faster on subsequent visits in production, and gives
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import {Dispatcher} from 'flux';
|
||||||
|
|
||||||
export interface IEvent {
|
export interface IEvent {
|
||||||
type: string;
|
type: string;
|
||||||
|
// tslint:disable-next-line
|
||||||
payload?: any;
|
payload?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue