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

Identity Provider: provide response to aragonAPI when user cancels identity modification #686

Merged
merged 1 commit into from Apr 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/App.js
Expand Up @@ -280,16 +280,18 @@ class App extends React.Component {
}

handleIdentityCancel = () => {
const { identityIntent } = this.state

identityIntent.reject(new Error('Identity modification cancelled'))
this.setState({ identityIntent: null })
}

handleIdentitySave = ({ address, label }) => {
const { identityIntent } = this.state
this.state.wrapper
.modifyAddressIdentity(address, { name: label })
.then(() =>
this.setState({ identityIntent: null }, identityIntent.resolve)
)
.then(identityIntent.resolve)
.then(() => this.setState({ identityIntent: null }))
Copy link
Contributor Author

@sohkai sohkai Apr 9, 2019

Choose a reason for hiding this comment

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

I think it's more clear this way (it also propagates the returned metadata to requestAddressIdentityModification()), but perhaps there was a reason for doing the resolution in the setState() callback?

Copy link
Contributor

@2color 2color Apr 10, 2019

Choose a reason for hiding this comment

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

I agree. I don't believe there was a reason.

.catch(identityIntent.reject)
}

Expand Down