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/addContactPage.jsx b/client/src/pages/addContactPage.jsx
index 702b01d..0fbd21b 100644
--- a/client/src/pages/addContactPage.jsx
+++ b/client/src/pages/addContactPage.jsx
@@ -1,50 +1,52 @@
-import { useNavigate } from "react-router-dom";
+import { useNavigate } from 'react-router-dom';
import { Box, Container, Fab, Card, CardContent, Typography } from '@mui/material';
import GroupAddRounded from '@mui/icons-material/GroupAddRounded';
-import authManager from '../AuthManager'
+import authManager from '../AuthManager';
import { useAppDispatch } from '../../redux/hooks';
import { setRefreshFromSlice } from '../../redux/appSlice';
-
export default function AddContactPage(props) {
const navigate = useNavigate();
- const accountId = props.accountId || props.match.params.accountId
- const contactId = props.contactId || props.match.params.contactId
+ const accountId = props.accountId || props.match.params.accountId;
+ const contactId = props.contactId || props.match.params.contactId;
const dispatch = useAppDispatch();
- const handleClick = async e => {
- const response = await authManager.fetch(`/api/accounts/${accountId}/conversations`, {
- method: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({members:[contactId]})
- }).then(res => {
- dispatch(setRefreshFromSlice())
- return res.json()
- })
+ const handleClick = async (e) => {
+ const response = await authManager
+ .fetch(`/api/accounts/${accountId}/conversations`, {
+ method: 'POST',
+ headers: {
+ Accept: 'application/json',
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ members: [contactId] }),
+ })
+ .then((res) => {
+ dispatch(setRefreshFromSlice());
+ return res.json();
+ });
- console.log(response)
+ console.log(response);
if (response.conversationId) {
- navigate(`/account/${accountId}/conversation/${response.conversationId}`)
+ navigate(`/account/${accountId}/conversation/${response.conversationId}`);
}
- }
+ };
return (
- <Container className='messenger'>
- <Card variant='outlined' style={{ borderRadius: 16, maxWidth: 560, margin: "16px auto" }}>
+ <Container className="messenger">
+ <Card variant="outlined" style={{ borderRadius: 16, maxWidth: 560, margin: '16px auto' }}>
<CardContent>
- <Typography variant='h6'>Jami key ID</Typography>
- <Typography variant='body1'>{contactId}</Typography>
- <Box style={{textAlign: 'center', marginTop: 16}}>
- <Fab variant='extended' color='primary' onClick={handleClick}>
- <GroupAddRounded/>
- Add contact
- </Fab>
+ <Typography variant="h6">Jami key ID</Typography>
+ <Typography variant="body1">{contactId}</Typography>
+ <Box style={{ textAlign: 'center', marginTop: 16 }}>
+ <Fab variant="extended" color="primary" onClick={handleClick}>
+ <GroupAddRounded />
+ Add contact
+ </Fab>
</Box>
</CardContent>
</Card>
- </Container>)
+ </Container>
+ );
}