Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fe/src/components/buttons/GitHubLoginButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import styled from 'styled-components';

const GitHubLoginButton = () => {
return (
<a href="https://github.com/login/oauth/authorize?client_id=a1689d4a012d841d152a&redirect_uri=http://kyupig.com/login/callback&scope=user">
<a href={`https://github.com/login/oauth/authorize?client_id=a1689d4a012d841d152a&redirect_uri=${process.env.REACT_APP_OAUTH_REDIRECT_URL}/login/callback&scope=user`}>
<StyledCreateButton variant="contained" size="large">
GitHub 계정으로 로그인
</StyledCreateButton>
</a>
);
};
};

export default GitHubLoginButton;

Expand Down
24 changes: 23 additions & 1 deletion fe/src/components/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,47 @@
import { Button } from '@material-ui/core';
import AuthorAvatar from 'components/common/AuthorAvatar';
import Logo from 'components/common/Logo';
import { useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import { decodedUserDataAtom } from 'stores/userStore';
import styled from 'styled-components';
import { DecodedUserDataType } from 'types/storeTypes';

const Header = () => {
const history = useHistory();
const decodedUserData = useRecoilValue<DecodedUserDataType | null>(
decodedUserDataAtom
);

const clickHandler = () => {
localStorage.removeItem('jwt');
history.push('/');
};


return (
<StyledHeader>
<Logo />
<AuthorAvatar profileImg={decodedUserData?.avatar_url} size="L" />
<StyledFlex>
<LogoutBtn onClick={clickHandler}>로그 아웃</LogoutBtn>
<AuthorAvatar profileImg={decodedUserData?.avatar_url} size="L" />
</StyledFlex>
</StyledHeader>
);
};

export default Header;

const StyledFlex = styled.div`
display: flex;
margin-right: 30px;
`;

const LogoutBtn = styled(Button)`
margin-right: 30px;
`;

const StyledHeader = styled.div`
display: flex;
width: 100%;
Expand Down