refactor(web): remove typescript

This commit is contained in:
Ali BARIN
2024-02-27 15:23:23 +00:00
parent 636870a075
commit b3ae2d2748
337 changed files with 2067 additions and 4997 deletions

View File

@@ -1,40 +1,24 @@
import * as React from 'react';
import { useNavigate } from 'react-router-dom';
import MenuItem from '@mui/material/MenuItem';
import Menu, { MenuProps } from '@mui/material/Menu';
import Menu from '@mui/material/Menu';
import { Link } from 'react-router-dom';
import Can from 'components/Can';
import apolloClient from 'graphql/client';
import * as URLS from 'config/urls';
import useAuthentication from 'hooks/useAuthentication';
import useFormatMessage from 'hooks/useFormatMessage';
type AccountDropdownMenuProps = {
open: boolean;
onClose: () => void;
anchorEl: MenuProps['anchorEl'];
id: string;
};
function AccountDropdownMenu(
props: AccountDropdownMenuProps
): React.ReactElement {
function AccountDropdownMenu(props) {
const formatMessage = useFormatMessage();
const authentication = useAuthentication();
const navigate = useNavigate();
const { open, onClose, anchorEl, id } = props;
const logout = async () => {
authentication.updateToken('');
await apolloClient.clearStore();
onClose();
navigate(URLS.LOGIN);
};
return (
<Menu
anchorEl={anchorEl}
@@ -56,10 +40,7 @@ function AccountDropdownMenu(
</MenuItem>
<Can I="read" a="User">
<MenuItem
component={Link}
to={URLS.ADMIN_SETTINGS_DASHBOARD}
>
<MenuItem component={Link} to={URLS.ADMIN_SETTINGS_DASHBOARD}>
{formatMessage('accountDropdownMenu.adminSettings')}
</MenuItem>
</Can>
@@ -70,5 +51,4 @@ function AccountDropdownMenu(
</Menu>
);
}
export default AccountDropdownMenu;