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

Error message modification in the asset configuration page #8031

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

AshrafMd-1
Copy link
Contributor

Proposed Changes

@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

@AshrafMd-1 AshrafMd-1 requested a review from a team as a code owner June 16, 2024 07:05
Copy link

vercel bot commented Jun 16, 2024

@AshrafMd-1 is attempting to deploy a commit to the Open Healthcare Network Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

netlify bot commented Jun 16, 2024

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit 039d7a8
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/666e8ec4dab7070009648a18
😎 Deploy Preview https://deploy-preview-8031--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.

@nihal467
Copy link
Member

@AshrafMd-1 is it good for testing ?

@AshrafMd-1
Copy link
Contributor Author

@nihal467 yes. You can test it

Comment on lines +17 to +39
// Asset IP Conflict
if (
Array.isArray(error?.non_field_errors) &&
error.non_field_errors.length === 1 &&
error.non_field_errors[0].includes("IP Address")
) {
const errorMsg = error.non_field_errors[0];

const ipAddress = errorMsg.split(" ")[2];

const facility = errorMsg
.substring(errorMsg.indexOf("by") + 3)
.split(" ")
.slice(0, -1)
.join(" ");

notify?.BadRequest({
errs: `IP Conflict: ${ipAddress} is in-use by '${facility}' asset within the facility`,
});

return;
}

Copy link
Member

Choose a reason for hiding this comment

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

this logic is specific to asset configuration and not across all requests. Move this to be done in the onResponse of the request options and dispatch notification there instead of in the shared handleResponse

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hey @rithviknishad

i did try but it says
TS2339: Property status does not exist on type RequestResult

image

Copy link
Member

Choose a reason for hiding this comment

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

res should be deconstructed from the params

onResponse: ({ res }) => { ... }

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.

Modify the error message in the asset configuration page
3 participants