Skip to content

Commit

Permalink
fix: remove openattestation field update for input change (#152)
Browse files Browse the repository at this point in the history
<!--
  For Work In Progress Pull Requests, please use the Draft PR feature,
see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for
further details.
  
  For a timely review/response, please avoid force-pushing additional
  commits if your PR already received reviews or comments.
  
Before submitting a Pull Request, please ensure you've done the
following:
- 📖 Read the [Contributing
Guide](https://github.com/uncefact/project-vckit/blob/main/CONTRIBUTING.md).
- 📖 Read the [Code of
Conduct](https://github.com/uncefact/project-vckit/blob/main/CODE_OF_CONDUCT.md).
  - 👷‍♀️ Create small PRs. In most cases, this will be possible.
  - ✅ Provide tests for your changes.
- 📝 Use descriptive commit messages following [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
- 📗 Update any related documentation and include any relevant
screenshots.
-->

## What type of PR is this? (check all applicable)

- [ ] 🍕 Feature
- [x] 🐛 Bug Fix
- [ ] 📝 Documentation Update
- [ ] 🎨 Style
- [ ] 🧑‍💻 Code Refactor
- [ ] 🔥 Performance Improvements
- [ ] ✅ Test
- [ ] 🤖 Build
- [ ] 🔁 CI
- [ ] 📦 Chore (Release)
- [ ] ⏩ Revert

## Description

<!-- 
Please do not leave this blank 
This PR [adds/removes/fixes/replaces] the [feature/bug/etc]. 
-->

## Related Tickets & Documents
<!-- 
Please use this format link issue numbers: Fixes #123

https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->

## Mobile & Desktop Screenshots/Recordings

<!-- Visual changes require screenshots -->


## Added tests?

- [ ] 👍 yes
- [x] 🙅 no, because they aren't needed
- [ ] 🙋 no, because I need help

## Added to documentation?

- [ ] 📜 README.md
- [ ] 📓 [vc-kit doc site](https://uncefact.github.io/vckit/)
- [ ] 📕 storybook
- [x] 🙅 no documentation needed

## [optional] Are there any post-deployment tasks we need to perform?


<!-- note: PRs with deleted sections will be marked invalid -->
  • Loading branch information
hoa-ngo-gs authored Aug 21, 2023
1 parent 96de874 commit 660be5b
Showing 1 changed file with 0 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,59 +146,6 @@ const IssueCredentialFromSchema: React.FC<IssueCredentialFromSchemaProps> = ({
const onChange = ({ errors, data }: { errors: any[]; data: any }) => {
setFormData(data)
setErrors([...errors])

if (data.proofFormat !== 'OpenAttestationMerkleProofSignature2018') {
setFormData((d: any) =>
dropFields(d, ['identityProofType', 'identityProofIdentifier']),
)
}

if (data.proofFormat === 'OpenAttestationMerkleProofSignature2018') {
if (data.identityProofType) {
const newErrors = errors.filter(
(e) => e.instancePath !== '/identityProofType',
)
setAdditionalErrors(newErrors)
setErrors(newErrors)
} else {
const newError: ErrorObject = {
// AJV style path to the property in the schema
instancePath: '/identityProofType',
// message to display
message: 'is a required property',
schemaPath: '',
keyword: '',
params: {},
}
setAdditionalErrors((errors) => [...errors, newError])
setErrors([...errors, newError])
}

if (
data.identityProofType === 'DNS-DID' ||
data.identityProofType === 'DNS-TXT'
) {
if (data.identityProofIdentifier) {
const newErrors = errors.filter(
(e) => e.instancePath !== '/identityProofIdentifier',
)
setAdditionalErrors(newErrors)
setErrors(newErrors)
} else {
const newError: ErrorObject = {
// AJV style path to the property in the schema
instancePath: '/identityProofIdentifier',
// message to display
message: 'is a required property',
schemaPath: '',
keyword: '',
params: {},
}
setAdditionalErrors((errors) => [...errors, newError])
setErrors([...errors, newError])
}
}
}
}

const signVc = async (fields: Field[]) => {
Expand Down

0 comments on commit 660be5b

Please sign in to comment.