GU-99 / grow-up-fe

MIT License
2 stars 1 forks source link

Fix: #266 AT 기간 만료 시 로직 수정 #267

Closed Yoonyesol closed 3 weeks ago

Yoonyesol commented 3 weeks ago

PR Type

What kind of change does this PR introduce?

Related Issues

What does this PR do?

View

토큰 만료 확인 및 재발급을 5초 주기로 설정한 뒤 테스트하였습니다. at만료재발급

Other information

기존에는 setTimeout으로 인한 액세스 토큰 기간 만료 문제를 해결해야 한다고 생각하고 수정을 진행했습니다. 하지만 액세스 토큰 만료 시 새로운 액세스 토큰을 요청할 때 서버에서 만료 시간 역시 새로 받아오기 때문에, 서버와 액세스 토큰 유지 기간을 동기화하기 위해서는 프론트에서 setTimeout으로 체크 중인 만료 시간 역시 초기화하는 게 맞다는 생각이 들었습니다. 따라서 만료 문제는 따로 처리할 필요가 없었기에 기존 로직을 그대로 유지했습니다.😂

대신 대기 상태에서 액세스 토큰 만료기간이 끝나 액세스 토큰이 자연 휘발될 시 새로운 액세스 토큰 요청을 보내고, 새로운 액세스 토큰을 잘 받아오는지 테스트를 진행했습니다. 기존 로직에 setTimeout으로 인해 isAuthenticated 변수가 초기화되는 문제가 존재해서 이를 처리했습니다. (isAuthenticated 변수는 로그인 내내 true로 유지되어야 하는 변수이므로, setTimeout으로 인한 토큰 만료 시에도 true 값을 유지해야 합니다.)

테스트 결과, 기존에 발생했던

coderabbitai[bot] commented 3 weeks ago

Walkthrough

이 PR은 src/stores/useStore.tsAuthStore 슬라이스 내 onLogin 메서드의 구현을 수정합니다. 주요 변경 사항은 액세스 토큰 만료 후 isAuthenticatedfalse로 설정하는 코드를 제거한 것입니다. 이로 인해 사용자가 로그인하면 인증 상태가 다른 작업(예: onLogout)으로 명시적으로 변경될 때까지 true로 유지됩니다. onVerifyCode 메서드는 변경되지 않았으며, 스토어의 전체 구조는 그대로 유지됩니다.

Changes

파일 경로 변경 요약
src/stores/useStore.ts onLogin 메서드에서 isAuthenticated를 자동으로 false로 설정하는 코드 제거

Assessment against linked issues

Objective Addressed Explanation
대기상태에서 액세스 토큰 만료 시, 액세스 토큰을 자동으로 재발급 받도록 수정 (#266) 액세스 토큰 만료 시 자동 재발급 처리에 대한 변경이 없음.

Possibly related PRs

Suggested reviewers

🐇 로그인 후 인증 상태가 계속 유지되니,
토큰 만료 걱정은 이제 안녕히!
상태 변화는 명확하게,
더 이상 혼란은 없어요,
이젠 마음 편히 달려가요! 🌼


📜 Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
📥 Commits Reviewing files that changed from the base of the PR and between 74476133626a464f589ef184364257b20c1e9798 and ae6a121a1ec55c48fcfe5c5183f7d1c61f69c6b6.
📒 Files selected for processing (1) * `src/stores/useStore.ts` (0 hunks)
💤 Files with no reviewable changes (1) * src/stores/useStore.ts

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
Yoonyesol commented 3 weeks ago

@Seok93 오오 다행이네요! 리뷰 감사합니다😊