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

🛠️ Replaced useDispatch w. useQuery: DeathReport (src/Components/DeathReport/DeathReport.tsx) #6450

Merged
merged 11 commits into from
Oct 25, 2023

Conversation

shyamprakash123
Copy link
Contributor

@shyamprakash123 shyamprakash123 commented Oct 15, 2023

WHAT

🤖 Generated by Copilot at 949d809

This pull request improves the code quality and readability of the DeathReport component and the API request for getting patient details. It uses the useQuery and useEffect hooks, and adds type annotations for the routes.getPatient object in src/Redux/api.tsx.

Proposed Changes

Screenshot 2023-10-15 195851

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

HOW

🤖 Generated by Copilot at 949d809

  • Replace the fetchpatient function and the useCallback hook with the useQuery and useEffect hooks to simplify the API request and data formatting logic in DeathReport.tsx (link, link)
  • Import the useQuery hook and the routes object from the new API request abstraction layer in DeathReport.tsx (link)
  • Remove unused dependencies and disable eslint warning for unused variables in DeathReport.tsx (link)
  • Add the TRes and TBody types to the routes.getPatient object to specify the expected response and body types for the API request in api.tsx (link)

@shyamprakash123 shyamprakash123 requested a review from a team October 15, 2023 14:30
@shyamprakash123 shyamprakash123 requested a review from a team as a code owner October 15, 2023 14:30
@vercel
Copy link

vercel bot commented Oct 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
care-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2023 1:14pm

@netlify
Copy link

netlify bot commented Oct 15, 2023

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit 00a1539
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/6539147658d67700081010b5
😎 Deploy Preview https://deploy-preview-6450--care-egov-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@shyamprakash123
Copy link
Contributor Author

shyamprakash123 commented Oct 15, 2023

Hello, @rithviknishad @khavinshankar @mathew-alex In this PR I changed useDispatch with useQuery. It is working as expected and cypress tests for DeathReport are also passing. so, can you review this PR once?

Note:

  • I didn't remove the getPatient action in actions.tsx because it is used in other components.

src/Redux/api.tsx Outdated Show resolved Hide resolved
src/Redux/api.tsx Outdated Show resolved Hide resolved
src/Components/DeathReport/DeathReport.tsx Outdated Show resolved Hide resolved
src/Components/DeathReport/DeathReport.tsx Outdated Show resolved Hide resolved
@shyamprakash123
Copy link
Contributor Author

@rithviknishad, I have changed the code as per the requested changes. Can you review this PR once?

@nihal467
Copy link
Member

LGTM

@khavinshankar khavinshankar merged commit 438dc61 into ohcnetwork:develop Oct 25, 2023
31 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🛠️ Replace useDispatch w. useQuery/request: DeathReport (src/Components/DeathReport/**)
4 participants