fix more linting issues

main
Cameron Clough 2022-01-07 15:52:41 +00:00
parent e4bd1c8adf
commit 2f9e5e905a
No known key found for this signature in database
GPG Key ID: BFB3B74B026ED43F
6 changed files with 26 additions and 30 deletions

View File

@ -37,31 +37,29 @@ function App() {
mode: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light', mode: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light',
}, },
}), }),
[true], [],
); );
return ( return (
<div className="App"> <div className="App">
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<CssBaseline /> <CssBaseline />
<UserProvider>
<DeviceStore>
<ToastStore>
<GlobalSnack /> <UserProvider>
<DeviceStore>
<ToastStore>
{session ? <UserAdmin/> : <Login />} <GlobalSnack />
</ToastStore> {session ? <UserAdmin /> : <Login />}
</DeviceStore>
</UserProvider> </ToastStore>
</DeviceStore>
</UserProvider>
</ThemeProvider> </ThemeProvider>
</div> </div>
); );
} }

View File

@ -33,18 +33,18 @@ function loading() {
export default function EnhancedTable(props) { export default function EnhancedTable(props) {
const [state, dispatch] = useContext(DeviceContext) const [state, dispatch] = useContext(DeviceContext)
const [ notifState, notifdispatch ] = useContext(SnackbarContext) const [, notifDispatch] = useContext(SnackbarContext)
useEffect(() => { useEffect(() => {
deviceController.getBootlogs(props.dongleId).then((res) => { deviceController.getBootlogs(props.dongleId).then((res) => {
setTimeout(() => { setTimeout(() => {
dispatch({ type: "update_dongle_bootlogs", dongle_id: props.dongleId, bootlogs: res.data }) dispatch({ type: "update_dongle_bootlogs", dongle_id: props.dongleId, bootlogs: res.data })
}, 1) }, 1)
}).catch((err) => { }).catch(() => {
notifdispatch({type: "NEW_TOAST", msg: 'Failed to load bootlogs'}) notifDispatch({type: "NEW_TOAST", msg: 'Failed to load bootlogs'})
}) })
}, []); }, [dispatch, notifDispatch, props.dongleId])
return ( return (
<Box sx={{ width: '100%' }}> <Box sx={{ width: '100%' }}>

View File

@ -1,7 +1,7 @@
import React from 'react';
import Box from '@mui/material/Box'; import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper'; import Paper from '@mui/material/Paper';
import React, { useContext } from 'react';
//import { JsonFormatter } from 'react-json-formatter' //import { JsonFormatter } from 'react-json-formatter'
/* /*

View File

@ -75,8 +75,7 @@ export default function EnhancedTable(props) {
deviceController.getCrashlogs(props.dongleId).then((res) => { deviceController.getCrashlogs(props.dongleId).then((res) => {
dispatch({ type: "update_dongle_bootlogs", dongle_id: props.dongleId, bootlogs: res.data }) dispatch({ type: "update_dongle_bootlogs", dongle_id: props.dongleId, bootlogs: res.data })
}) })
}, [dispatch, props.dongleId]);
}, []);
console.log("drives", state.dongles[props.dongleId]) console.log("drives", state.dongles[props.dongleId])
console.log("drives", typeof state.dongles[props.dongleId]) console.log("drives", typeof state.dongles[props.dongleId])

View File

@ -19,17 +19,17 @@ import * as helpers from "./../../../controllers/helpers"
export default function SignIn(props) { export default function SignIn(props) {
const [state] = useContext(DeviceContext) const [state] = useContext(DeviceContext)
const [notifState, notifdispatch] = useContext(SnackbarContext) const [, notifDispatch] = useContext(SnackbarContext)
function pubKeyClipboard(newClip) { function pubKeyClipboard(newClip) {
navigator.clipboard.writeText(newClip).then(function () { navigator.clipboard.writeText(newClip).then(function () {
notifdispatch({ notifDispatch({
type: "NEW_TOAST", type: "NEW_TOAST",
open: true, open: true,
msg: "Successfully copied to clipboard!" msg: "Successfully copied to clipboard!"
}) })
}, function () { }, function () {
notifdispatch({ notifDispatch({
type: "NEW_TOAST", type: "NEW_TOAST",
open: true, open: true,
msg: "Failed to write to clipboard!" msg: "Failed to write to clipboard!"

View File

@ -25,7 +25,7 @@ import ViewDrive from "./view_drive"
export default function EnhancedTable(props) { export default function EnhancedTable(props) {
const [deviceState, dispatch] = useContext(DeviceContext) const [deviceState, dispatch] = useContext(DeviceContext)
const [ notifState, notifdispatch ] = useContext(SnackbarContext) const [, notifDispatch] = useContext(SnackbarContext)
const [state, setState] = useState({selectedSegment: null}) const [state, setState] = useState({selectedSegment: null})
useEffect(() => { useEffect(() => {
@ -33,11 +33,10 @@ export default function EnhancedTable(props) {
setTimeout(() => { setTimeout(() => {
dispatch({ type: "update_dongle_drive", dongle_id: props.dongleId, drives: res.data }) dispatch({ type: "update_dongle_drive", dongle_id: props.dongleId, drives: res.data })
}, 1) }, 1)
}).catch((err) => { }).catch(() => {
notifdispatch({type: "NEW_TOAST", msg: 'Failed to load drives'}) notifDispatch({type: "NEW_TOAST", msg: 'Failed to load drives'})
}) })
}, [dispatch, notifDispatch, props.dongleId])
}, []);
return ( return (
<Box sx={{ width: '100%' }}> <Box sx={{ width: '100%' }}>