Skip to content

Commit

Permalink
[FE/#15] Refactor : pipe 함수를 통해 상태변경
Browse files Browse the repository at this point in the history
  • Loading branch information
sungik-choi committed Jun 24, 2020
1 parent 5ca62bd commit f0556a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 2 additions & 4 deletions FE/src/components/common/Header/UserMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useContext } from "react";
import PropTypes from "prop-types";
import { useCookies } from "react-cookie";
import pipe from "@Utils/pipe";

import Popover from "@material-ui/core/Popover";
import PopupState, { bindTrigger, bindPopover } from "material-ui-popup-state";
Expand All @@ -26,10 +27,7 @@ const UserMenu = ({ userId, url }) => {
const [, , removeCookie] = useCookies([TOKEN]);
const { userDispatch } = useContext(UserContext);

const signOutHandler = () => {
removeCookie(TOKEN);
userDispatch(deleteUserData());
};
const signOutHandler = () => pipe(removeCookie, deleteUserData, userDispatch)(TOKEN);

return (
<PopupState variant="popover" popupId="demo-popup-popover">
Expand Down
2 changes: 0 additions & 2 deletions FE/src/pages/Login.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { useContext, useEffect } from "react";

import jwtDecode from "jwt-decode";
import { useCookies } from "react-cookie";

import pipe from "@Utils/pipe";

import { UserContext } from "@Contexts/userContext";
Expand Down

0 comments on commit f0556a4

Please sign in to comment.