refactor(web): remove typescript
This commit is contained in:
@@ -9,7 +9,6 @@ import { styled } from '@mui/material/styles';
|
||||
import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar';
|
||||
import * as React from 'react';
|
||||
import * as yup from 'yup';
|
||||
|
||||
import Container from 'components/Container';
|
||||
import DeleteAccountDialog from 'components/DeleteAccountDialog/index.ee';
|
||||
import Form from 'components/Form';
|
||||
@@ -18,13 +17,6 @@ import TextField from 'components/TextField';
|
||||
import { UPDATE_CURRENT_USER } from 'graphql/mutations/update-current-user';
|
||||
import useCurrentUser from 'hooks/useCurrentUser';
|
||||
import useFormatMessage from 'hooks/useFormatMessage';
|
||||
|
||||
type TMutationInput = {
|
||||
fullName: string;
|
||||
email: string;
|
||||
password?: string;
|
||||
};
|
||||
|
||||
const validationSchema = yup
|
||||
.object({
|
||||
fullName: yup.string().required(),
|
||||
@@ -35,13 +27,11 @@ const validationSchema = yup
|
||||
.oneOf([yup.ref('password')], 'Passwords must match'),
|
||||
})
|
||||
.required();
|
||||
|
||||
const StyledForm = styled(Form)`
|
||||
display: flex;
|
||||
align-items: end;
|
||||
flex-direction: column;
|
||||
`;
|
||||
|
||||
function ProfileSettings() {
|
||||
const [showDeleteAccountConfirmation, setShowDeleteAccountConfirmation] =
|
||||
React.useState(false);
|
||||
@@ -49,19 +39,15 @@ function ProfileSettings() {
|
||||
const currentUser = useCurrentUser();
|
||||
const formatMessage = useFormatMessage();
|
||||
const [updateCurrentUser] = useMutation(UPDATE_CURRENT_USER);
|
||||
|
||||
const handleProfileSettingsUpdate = async (data: any) => {
|
||||
const handleProfileSettingsUpdate = async (data) => {
|
||||
const { fullName, password, email } = data;
|
||||
|
||||
const mutationInput: TMutationInput = {
|
||||
const mutationInput = {
|
||||
fullName,
|
||||
email,
|
||||
};
|
||||
|
||||
if (password) {
|
||||
mutationInput.password = password;
|
||||
}
|
||||
|
||||
await updateCurrentUser({
|
||||
variables: {
|
||||
input: mutationInput,
|
||||
@@ -75,15 +61,13 @@ function ProfileSettings() {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
enqueueSnackbar(formatMessage('profileSettings.updatedProfile'), {
|
||||
variant: 'success',
|
||||
SnackbarProps: {
|
||||
'data-test': 'snackbar-update-profile-settings-success'
|
||||
}
|
||||
'data-test': 'snackbar-update-profile-settings-success',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Container sx={{ py: 3, display: 'flex', justifyContent: 'center' }}>
|
||||
<Grid container item xs={12} sm={9} md={8} lg={6}>
|
||||
@@ -209,5 +193,4 @@ function ProfileSettings() {
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProfileSettings;
|
Reference in New Issue
Block a user