Skip to content

Optimize database connection error#52

Merged
PCBZ merged 3 commits intomainfrom
optimize_database_connection_error
Apr 22, 2025
Merged

Optimize database connection error#52
PCBZ merged 3 commits intomainfrom
optimize_database_connection_error

Conversation

@PCBZ
Copy link
Copy Markdown
Owner

@PCBZ PCBZ commented Apr 22, 2025

No description provided.

@PCBZ PCBZ merged commit f55f8e1 into main Apr 22, 2025
2 checks passed
PCBZ added a commit that referenced this pull request Apr 24, 2025
@PCBZ PCBZ self-assigned this Apr 28, 2025
@PCBZ PCBZ requested a review from Copilot April 28, 2025 18:22
@PCBZ PCBZ added the enhancement New feature or request label Apr 28, 2025
@PCBZ PCBZ deleted the optimize_database_connection_error branch April 28, 2025 18:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR focuses on optimizing database connection error handling and authentication flows while refactoring redundant token management. Key changes include:

  • Migrating from legacy token handling (using localStorage) to sessionStorage in authentication services.
  • Refactoring donor list service calls to use a centralized fetch method from baseService.
  • Updating middleware and server error handling responses with structured error messages and clearer comments.
  • Removing pull_request triggers from CI workflows to focus solely on push events.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
client/src/services/donorListService.js Refactored API calls to use fetchWithAuth from baseService
client/src/services/baseService.js Added generic fetchWithAuth function for token-based API calls
client/src/services/authService.js Updated authentication to use sessionStorage and simplified flow
client/src/middleware/authMiddleware.js Changed middleware function naming and error handling
client/src/config.js Moved API configuration to a centralized config file
client/src/components/donors/Donors.jsx Minor debugging log present; otherwise, donor data processing unchanged
Server/src/routes/donor.js Converted comments and error messages to English
Server/src/middleware/auth.js Introduced structured and detailed error responses
.github/workflows/docker-build.yml Removed pull_request trigger
.github/workflows/cd.yml Removed pull_request trigger
Comments suppressed due to low confidence (1)

client/src/middleware/authMiddleware.js:4

  • [nitpick] The function name 'withAuth' might be unclear; consider renaming it to something like 'handleUnauthorizedResponse' to clearly indicate its purpose.
export const withAuth = async (response) => {

}
}

console.log('response.data', response.data);
Copy link

Copilot AI Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider removing the debug log in production code to avoid unintended console output.

Suggested change
console.log('response.data', response.data);
// Debug log removed: console.log('response.data', response.data);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants