Refactored

This commit is contained in:
Filip Izydorczyk
2020-06-20 14:10:58 +02:00
parent 9da1dfd51f
commit 124170492c
5 changed files with 81 additions and 38 deletions

View File

@ -1,16 +1,16 @@
import { Menu, MenuItem } from "@material-ui/core";
import React, { FC } from "react";
import BusinessLogicContext from "../../businesslogic/BusinessLogicContext";
import { BuisnessProvided } from "../../businesslogic/BusinessLogicProvider";
interface ProfileProps {
anchorEl: HTMLElement | null;
handleClose: () => void;
handleLogout: () => void;
}
export const Profile: FC<ProfileProps> = ({
anchorEl,
handleClose,
handleLogout,
...restProps
}) => {
return (
@ -24,17 +24,13 @@ export const Profile: FC<ProfileProps> = ({
>
<MenuItem>Profile</MenuItem>
<MenuItem>My account</MenuItem>
<BusinessLogicContext.Consumer>
{(context) => (
<MenuItem
onClick={() => {
(context as BuisnessProvided).reducers();
}}
>
Logout
</MenuItem>
)}
</BusinessLogicContext.Consumer>
<MenuItem
onClick={() => {
handleLogout();
}}
>
Logout
</MenuItem>
</Menu>
);
};