Fix lint errors
Manually fix all lint errors.
Some errors could not be fixed, a TODO comment was added.
To fix errors caused by `react-hooks/exhaustive-deps`, missing
dependencies were added to the dependencies array of some `useEffect`
calls.
We need to make sure that all `useEffect` call work as intended before
merging
Gitlab: #29
Change-Id: I939a99b0be53795ecc28d25b5067f037403f5e08
diff --git a/client/src/pages/accountCreation.jsx b/client/src/pages/accountCreation.jsx
index cd948a2..b8c323b 100644
--- a/client/src/pages/accountCreation.jsx
+++ b/client/src/pages/accountCreation.jsx
@@ -14,7 +14,7 @@
<Typography variant="body2" color="textSecondary" component="p">
Welcome to the Jami web node setup.
<br />
- Let's start by creating a new administrator account to control access to the server configuration.
+ Let's start by creating a new administrator account to control access to the server configuration.
</Typography>
</CardContent>
diff --git a/client/src/pages/accountSelection.jsx b/client/src/pages/accountSelection.jsx
index 8d96885..e8bbf1e 100644
--- a/client/src/pages/accountSelection.jsx
+++ b/client/src/pages/accountSelection.jsx
@@ -45,7 +45,7 @@
)
.catch((e) => console.log(e));
// return () => controller.abort() // crash on React18
- }, []);
+ }, [navigate]);
if (!loaded) return <LoadingPage />;
return (
diff --git a/client/src/pages/accountSettings.jsx b/client/src/pages/accountSettings.jsx
index ed580e2..10dab29 100644
--- a/client/src/pages/accountSettings.jsx
+++ b/client/src/pages/accountSettings.jsx
@@ -11,7 +11,10 @@
const AccountSettings = (props) => {
console.log('ACCOUNT SETTINGS', props.account);
- const accountId = props.accountId || useParams().accountId;
+ let accountId = useParams().accountId;
+ if (props.accountId) {
+ accountId = props.accountId;
+ }
const dispatch = useAppDispatch();
const [state, setState] = useState({ loaded: false });
@@ -31,7 +34,7 @@
})
.catch((e) => console.log(e));
// return () => controller.abort() // crash on React18
- }, [accountId]);
+ }, [accountId, dispatch]);
return (
<Container maxWidth="sm">
diff --git a/client/src/pages/jamiAccountCreation.jsx b/client/src/pages/jamiAccountCreation.jsx
index fbff909..09f8612 100644
--- a/client/src/pages/jamiAccountCreation.jsx
+++ b/client/src/pages/jamiAccountCreation.jsx
@@ -43,7 +43,7 @@
<Typography variant="body2" color="textSecondary" component="p">
Welcome to the Jami web node setup.
<br />
- Let's start by creating a new administrator account to control access to the server configuration.
+ Let's start by creating a new administrator account to control access to the server configuration.
</Typography>
<Box>
diff --git a/client/src/pages/serverConfiguration.jsx b/client/src/pages/serverConfiguration.jsx
index da6250a..829977e 100644
--- a/client/src/pages/serverConfiguration.jsx
+++ b/client/src/pages/serverConfiguration.jsx
@@ -1,5 +1,6 @@
import CircularProgress from '@mui/material/CircularProgress';
import Container from '@mui/material/Container';
+import { useEffect, useState } from 'react';
import Account from '../../../model/Account';
import authManager from '../AuthManager';
@@ -7,7 +8,9 @@
import Header from '../components/Header';
const ServerOverview = (props) => {
- this.accountId = props.accountId || props.match.params.accountId;
+ const [loaded, setLoaded] = useState(false);
+ const [account, setAccount] = useState();
+ const accountId = props.accountId || props.match.params.accountId;
useEffect(() => {
const controller = new AbortController();
@@ -16,7 +19,8 @@
.then((res) => res.json())
.then((result) => {
console.log(result);
- setState({ loaded: true, account: Account.from(result) });
+ setLoaded(true);
+ setAccount(Account.from(result));
})
.catch((e) => console.log(e));
// return () => controller.abort() // crash on React18
@@ -25,7 +29,7 @@
return (
<Container maxWidth="sm" className="app">
<Header />
- {this.state.loaded ? <AccountPreferences account={this.state.account} /> : <CircularProgress />}
+ {loaded ? <AccountPreferences account={account} /> : <CircularProgress />}
</Container>
);
};
diff --git a/client/src/pages/serverSetup.jsx b/client/src/pages/serverSetup.jsx
index 95fc032..b7f79a7 100644
--- a/client/src/pages/serverSetup.jsx
+++ b/client/src/pages/serverSetup.jsx
@@ -28,7 +28,7 @@
<Typography variant="body2" color="textSecondary" component="p">
Welcome to the Jami web node setup.
<br />
- Let's start by creating a new administrator account to control access to the server configuration.
+ Let's start by creating a new administrator account to control access to the server configuration.
</Typography>
<Box style={{ textAlign: 'center', marginTop: 8, marginBottom: 16 }}>