Skip to content

issue #000 fix: log out issue fix#453

Merged
swayangjit merged 1 commit intoSunbird-ALL:all-2.0.0.1from
Ayansaha20:ApiChanges
Jul 31, 2025
Merged

issue #000 fix: log out issue fix#453
swayangjit merged 1 commit intoSunbird-ALL:all-2.0.0.1from
Ayansaha20:ApiChanges

Conversation

@Ayansaha20
Copy link
Copy Markdown
Contributor

@Ayansaha20 Ayansaha20 commented Jul 31, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for authentication issues. Users will now be logged out and redirected appropriately when "unauthorized" or "token" errors are detected.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

The axios response interceptor in src/App.js was updated to change the logout trigger condition. Instead of excluding "profanity" errors, the code now checks for "unauthorized" or "token" in the error message to initiate the logout process, which clears storage and either posts a message or redirects to login.

Changes

Cohort / File(s) Change Summary
Axios Error Handling Update
src/App.js
Modified the axios response interceptor to trigger logout actions when error messages include "unauthorized" or "token", updating the session and messaging logic accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant Axios
    participant ParentWindow

    User->>App: Makes API request
    App->>Axios: Sends request
    Axios-->>App: Returns error with message
    App->>App: Checks if error message includes "unauthorized" or "token"
    alt Error matches
        App->>App: Clear local/session storage
        alt Running in iframe with content session
            App->>ParentWindow: Post logout message
        else
            App->>App: Navigate to login page
        end
    else Error does not match
        App->>App: Handle error as usual
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Suggested reviewers

  • swayangjit

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between deb1b4c and 1ac19c0.

📒 Files selected for processing (1)
  • src/App.js (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ajinkyapandetekdi
PR: Sunbird-ALL/all-learner-ai-app#300
File: src/utils/constants.js:4347-4347
Timestamp: 2025-03-25T20:00:08.588Z
Learning: In the ALL Learner AI App, values previously stored in localStorage are now being migrated to Redux store as part of PR #300, making encryption/decryption functions like `handleDecrypt` in src/utils/constants.js obsolete.
Learnt from: ajinkyapandetekdi
PR: Sunbird-ALL/all-learner-ai-app#300
File: src/utils/constants.js:4333-4333
Timestamp: 2025-03-25T20:00:26.930Z
Learning: The `handleEncrypt` function in src/utils/constants.js is no longer being used in the codebase as part of the migration from localStorage to Redux store.
Learnt from: ajinkyapandetekdi
PR: Sunbird-ALL/all-learner-ai-app#300
File: src/components/AssesmentEnd/AssesmentEnd.jsx:65-65
Timestamp: 2025-03-25T20:06:50.181Z
Learning: The PR is migrating localStorage values to Redux store, so adding fallbacks to localStorage is counterproductive and against the migration strategy.
src/App.js (2)

Learnt from: ajinkyapandetekdi
PR: #300
File: src/utils/constants.js:4347-4347
Timestamp: 2025-03-25T20:00:08.588Z
Learning: In the ALL Learner AI App, values previously stored in localStorage are now being migrated to Redux store as part of PR #300, making encryption/decryption functions like handleDecrypt in src/utils/constants.js obsolete.

Learnt from: ajinkyapandetekdi
PR: #300
File: src/utils/constants.js:4333-4333
Timestamp: 2025-03-25T20:00:26.930Z
Learning: The handleEncrypt function in src/utils/constants.js is no longer being used in the codebase as part of the migration from localStorage to Redux store.

🔇 Additional comments (1)
src/App.js (1)

41-44: Improved logout trigger logic for authentication errors.

The change from excluding "profanity" errors to specifically checking for "unauthorized" or "token" in error messages is a logical improvement that better targets authentication-related failures.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this 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.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sonarqubecloud
Copy link
Copy Markdown

@swayangjit swayangjit merged commit 829a205 into Sunbird-ALL:all-2.0.0.1 Jul 31, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants