-
Notifications
You must be signed in to change notification settings - Fork 0
deploy: 2.1.0 배포 #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
deploy: 2.1.0 배포 #155
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f6cbd5d
fix: DOM 중첩 경고 해결 (#147)
AndyH0ng 16ee9a8
fix: 401 토스트 출력 로직 개선 (#148)
AndyH0ng a53d1aa
feat: 로그인 후 화면 갱신 (#149)
AndyH0ng 7ad9eac
feat: 로그인 여부 확인 후에 스켈레톤 렌더 (#150)
AndyH0ng 8afdd63
fix: CSP 널널하게 설정 (#147)
AndyH0ng 5dc243d
fix: 이름 변경 후 캐시 업데이트 (#147)
AndyH0ng 866926b
refactor: 코드 리뷰 반영 (#147)
AndyH0ng 760db52
fix: 변환 상태 타입 추가 (#147)
AndyH0ng f149eec
design: 스켈레톤 사용성 개선 (#147)
AndyH0ng 6a2db39
fix: 401 시에도 재시도하는 문제 수정 (#147)
AndyH0ng d07bffc
feat: 댓글/리액션 토글 시 토스트 삭제 (#147)
AndyH0ng 7b8a5f7
feat: 댓글 최신순 정렬 (#147)
AndyH0ng 451f9d7
feat: 토스트 정책 업데이트 (#147)
AndyH0ng d38fb3b
design: 토스트 라이팅 수정 (#147)
AndyH0ng 0622ca0
chore: revert 스켈레톤 사용성 개선 (#147)
AndyH0ng 22cf502
chore: 슬라이드 웹소켓 관련 코드 삭제 (#147)
AndyH0ng d55dc03
chore: 로그아웃 아이콘 추가 (#152)
AndyH0ng 34d8a75
feat: 로그인 버튼 UI 업데이트 (#152)
AndyH0ng ace9a33
chore: 코드 리뷰 반영 (#152)
AndyH0ng 1213eb9
Merge pull request #151 from TTORANG/fix/bugfix-147
AndyH0ng b01179e
Merge branch 'develop' into feat/login-ui-152
AndyH0ng 2da0902
Merge pull request #153 from TTORANG/feat/login-ui-152
AndyH0ng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,124 @@ | ||
| /** | ||
| * @file LoginButton.tsx | ||
| * @description 로그인 버튼 컴포넌트 | ||
| * @description 로그인/프로필 버튼 컴포넌트 | ||
| * | ||
| * 헤더 우측에 표시되는 로그인 링크입니다. | ||
| * 비로그인 상태: 로그인 버튼 (클릭 시 로그인 모달) | ||
| * 로그인 상태: 사용자 이름 + 프로필 이미지 (클릭 시 로그아웃/회원탈퇴 드롭다운) | ||
| */ | ||
| import { useState } from 'react'; | ||
|
|
||
| import { apiClient } from '@/api/client'; | ||
| import LoginIcon from '@/assets/icons/icon-login.svg?react'; | ||
| import LogoutIcon from '@/assets/icons/icon-logout.svg?react'; | ||
| import { Dropdown } from '@/components/common/Dropdown'; | ||
| import { Modal } from '@/components/common/Modal'; | ||
| import { useAuthStore } from '@/stores/authStore'; | ||
| import { showToast } from '@/utils/toast'; | ||
|
|
||
| import { HeaderButton } from './HeaderButton'; | ||
|
|
||
| export function LoginButton() { | ||
| const user = useAuthStore((s) => s.user); | ||
| const openLoginModal = useAuthStore((s) => s.openLoginModal); | ||
| const logout = useAuthStore((s) => s.logout); | ||
|
|
||
| const [isWithdrawModalOpen, setIsWithdrawModalOpen] = useState(false); | ||
| const [isWithdrawing, setIsWithdrawing] = useState(false); | ||
|
|
||
| if (!user) { | ||
| return <HeaderButton text="로그인" icon={<LoginIcon />} onClick={openLoginModal} />; | ||
| } | ||
|
|
||
| const handleWithdraw = async () => { | ||
| setIsWithdrawing(true); | ||
| try { | ||
| await apiClient.delete(`/users/${user.id}`); | ||
| logout(); | ||
| setIsWithdrawModalOpen(false); | ||
| showToast.success('회원 탈퇴가 완료되었습니다.'); | ||
| } catch { | ||
| showToast.error('회원 탈퇴에 실패했습니다.', '잠시 후 다시 시도해주세요.'); | ||
| } finally { | ||
| setIsWithdrawing(false); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <Dropdown | ||
| position="bottom" | ||
| align="end" | ||
| ariaLabel="사용자 메뉴" | ||
| trigger={ | ||
| <button | ||
| type="button" | ||
| className="flex cursor-pointer items-center gap-2 text-body-s-bold text-gray-800 transition-colors hover:text-gray-600" | ||
| > | ||
| {user.name ?? '사용자'} | ||
| {user.profileImage ? ( | ||
| <img | ||
| src={user.profileImage} | ||
| alt="프로필" | ||
| className="size-6 rounded-full object-cover" | ||
| /> | ||
| ) : ( | ||
| <div className="size-6 rounded-full bg-gray-200" /> | ||
| )} | ||
| </button> | ||
| } | ||
| items={[ | ||
| { | ||
| id: 'logout', | ||
| label: ( | ||
| <span className="flex items-center gap-1"> | ||
| 로그아웃 | ||
| <LogoutIcon className="size-6" /> | ||
| </span> | ||
| ), | ||
| onClick: logout, | ||
| variant: 'danger', | ||
| }, | ||
| { | ||
| id: 'withdraw', | ||
| label: '회원 탈퇴', | ||
| onClick: () => setIsWithdrawModalOpen(true), | ||
| variant: 'danger', | ||
| }, | ||
| ]} | ||
| /> | ||
|
|
||
| return <HeaderButton text="로그인" icon={<LoginIcon />} onClick={openLoginModal} />; | ||
| <Modal | ||
| isOpen={isWithdrawModalOpen} | ||
| onClose={() => setIsWithdrawModalOpen(false)} | ||
| title="회원 탈퇴" | ||
| size="sm" | ||
| closeOnBackdropClick={!isWithdrawing} | ||
| closeOnEscape={!isWithdrawing} | ||
| > | ||
| <p className="text-body-m"> | ||
| 탈퇴하면 모든 데이터가 삭제되며 복구할 수 없습니다. | ||
| <br /> | ||
| 정말 탈퇴하시겠습니까? | ||
| </p> | ||
| <div className="mt-7 flex gap-3"> | ||
| <button | ||
| className="flex-1 rounded-md bg-gray-100 py-3 font-bold text-gray-600 transition-colors hover:bg-gray-200 disabled:opacity-50" | ||
| type="button" | ||
| onClick={() => setIsWithdrawModalOpen(false)} | ||
| disabled={isWithdrawing} | ||
| > | ||
| 취소 | ||
| </button> | ||
| <button | ||
| className="flex-1 rounded-md bg-error py-3 font-bold text-white transition-colors hover:bg-error/90 disabled:opacity-50" | ||
| type="button" | ||
| onClick={handleWithdraw} | ||
| disabled={isWithdrawing} | ||
| > | ||
| {isWithdrawing ? '탈퇴 중...' : '탈퇴'} | ||
| </button> | ||
| </div> | ||
| </Modal> | ||
| </> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content-Security-Policy에서
script-src의 'unsafe-inline'과 'unsafe-eval'을 제거하여 보안을 강화한 점은 매우 좋습니다. 하지만style-src에는 여전히 'unsafe-inline'이 남아있습니다. 이는 인라인 스타일을 허용하여 잠재적인 Cross-Site Scripting (XSS) 공격의 경로가 될 수 있습니다. 가능하다면 이 지시문을 제거하고 클래스 기반 스타일링을 사용하거나, 스타일을 위한 nonce 또는 hash를 사용하는 것을 고려해 보세요.