Skip to content
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

fix: |UI| admin mails unknown page call wrong api #542

Merged
merged 1 commit into from
Jan 4, 2025

Conversation

dreamhunter2333
Copy link
Owner

@dreamhunter2333 dreamhunter2333 commented Jan 4, 2025

PR Type

bug fix


Description

  • Corrected API endpoint for deleting mails in admin view

Changes walkthrough 📝

Relevant files
Bug fix
MailsUnknow.vue
Correct API endpoint for deleting mails                                   

frontend/src/views/admin/MailsUnknow.vue

  • Fixed the API endpoint for deleting mails from /api/mails/ to
    /admin/mails/
  • +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    github-actions bot commented Jan 4, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Possible Issue

    Ensure that the corrected API endpoint /admin/mails/${curMailId} is the intended endpoint for deleting mails in the admin view.

    const deleteMail = async (curMailId) => {
        await api.fetch(`/admin/mails/${curMailId}`, { method: 'DELETE' });
    };

    Copy link

    github-actions bot commented Jan 4, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Add error handling for the API call in the deleteMail function

    Ensure that the deleteMail function handles potential errors from the API call to
    avoid unhandled promise rejections.

    frontend/src/views/admin/MailsUnknow.vue [14]

    -await api.fetch(`/admin/mails/${curMailId}`, { method: 'DELETE' });
    +try {
    +    await api.fetch(`/admin/mails/${curMailId}`, { method: 'DELETE' });
    +} catch (error) {
    +    console.error('Failed to delete mail:', error);
    +}
    Suggestion importance[1-10]: 9

    Why: Adding error handling to the deleteMail function is crucial to prevent unhandled promise rejections and improve the robustness of the code. This change ensures that any errors during the API call are caught and logged, enhancing the application's reliability.

    9

    @dreamhunter2333 dreamhunter2333 merged commit 934e58e into main Jan 4, 2025
    @dreamhunter2333 dreamhunter2333 deleted the feature/dev branch January 4, 2025 17:14
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant