Skip to content

Conversation

@rodrigoborgesdeoliveira
Copy link
Contributor

As the methods using then/catch chaining were not executing any code after the promises, they can be replaced with async/await for better readability and maintainability.

});
})

if(response.ok) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The .ok is a shorthand for the previous condition we had here.

Source: https://www.npmjs.com/package/node-fetch#responseok

Copy link
Collaborator

@alexanderjordanbaker alexanderjordanbaker left a comment

Choose a reason for hiding this comment

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

Thank you for this PR. LGTM

@alexanderjordanbaker alexanderjordanbaker merged commit 0a294ad into apple:main Jul 10, 2023
@rodrigoborgesdeoliveira rodrigoborgesdeoliveira deleted the refactor/then-catch branch July 10, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants