Format all files with no breaking changes
Lint all files using `npm run lint -- --fix`.
Format all files using `prettier --write "**/*.{ts,tsx,js,jsx,json}"`
No breaking change, only code style is modified.
Gitlab: #29
Change-Id: I4f034a7fb4d3eea10bcd3e38b44a65a1046de62f
diff --git a/client/src/pages/accountSettings.jsx b/client/src/pages/accountSettings.jsx
index 9808efd..e7d08c2 100644
--- a/client/src/pages/accountSettings.jsx
+++ b/client/src/pages/accountSettings.jsx
@@ -1,45 +1,55 @@
-import { useEffect, useState } from 'react'
+import { useEffect, useState } from 'react';
import { useParams } from 'react-router';
import { Container, CircularProgress } from '@mui/material';
-import Header from '../components/Header'
-import AccountPreferences from '../components/AccountPreferences'
-import authManager from '../AuthManager'
-import Account from '../../../model/Account'
-import { useAppSelector, useAppDispatch } from '../../redux/hooks';
+import Header from '../components/Header';
+import AccountPreferences from '../components/AccountPreferences';
+import authManager from '../AuthManager';
+import Account from '../../../model/Account';
+import { useAppDispatch } from '../../redux/hooks';
import { setAccountId, setAccountObject } from '../../redux/appSlice';
const AccountSettings = (props) => {
- console.log("ACCOUNT SETTINGS", props.account)
- const accountId = props.accountId || useParams().accountId
+ console.log('ACCOUNT SETTINGS', props.account);
+ const accountId = props.accountId || useParams().accountId;
const dispatch = useAppDispatch();
- const [state, setState] = useState({ loaded: false })
+ const [state, setState] = useState({ loaded: false });
useEffect(() => {
- dispatch(setAccountId(accountId))
+ dispatch(setAccountId(accountId));
- const controller = new AbortController()
- authManager.fetch(`/api/accounts/${accountId}`, { signal: controller.signal })
- .then(res => res.json())
- .then(result => {
- let account = Account.from(result)
- account.setDevices(result.devices)
- dispatch(setAccountObject(account))
- setState({ loaded: true, account: account})
-
- }).catch(e => console.log(e))
- // return () => controller.abort() // crash on React18
- }, [accountId])
+ const controller = new AbortController();
+ authManager
+ .fetch(`/api/accounts/${accountId}`, { signal: controller.signal })
+ .then((res) => res.json())
+ .then((result) => {
+ let account = Account.from(result);
+ account.setDevices(result.devices);
+ dispatch(setAccountObject(account));
+ setState({ loaded: true, account: account });
+ })
+ .catch((e) => console.log(e));
+ // return () => controller.abort() // crash on React18
+ }, [accountId]);
return (
<Container maxWidth="sm">
<Header />
- {state.loaded ? <AccountPreferences account={state.account} onAccontChanged={account => setState(state => {
- state.account = account
- return state
- })} /> : <CircularProgress />}
+ {state.loaded ? (
+ <AccountPreferences
+ account={state.account}
+ onAccontChanged={(account) =>
+ setState((state) => {
+ state.account = account;
+ return state;
+ })
+ }
+ />
+ ) : (
+ <CircularProgress />
+ )}
</Container>
- )
-}
+ );
+};
-export default AccountSettings;
\ No newline at end of file
+export default AccountSettings;