pohutukawa-2022 / gardenz

Empowering community gardens in New Zealand
0 stars 0 forks source link

Consistent Promise Handling - async / await: Batch 2 #32

Open alexcoaton opened 2 years ago

alexcoaton commented 2 years ago

There are over 150 uses of .then() in the codebase at the time of this issue creation. The objective is to eventually get them all converted to a single consistent style with async...await, instead, but it would be impractical to do them all at once.

Note that there is one exception where async / await can be problematic - inside useEffect() hook calls. Read this blog post to find out how to handle it correctly.

Considering the above exception, find uses of .then() in the following files and replace them with async / await-style promise handling.

image

GracieHayward commented 2 years ago

https://github.com/pohutukawa-2022/gardenz/tree/32-promise-handling

GracieHayward commented 2 years ago

:)

Luke-vanKan commented 2 years ago

Reviewed code and ran test and it looks great.

EliseWei commented 2 years ago

@GracieHayward and @karlbayly You need to open a pull request before this can get a tick from a peer and be reviewed by a teacher. Thank you!

GracieHayward commented 2 years ago

@EliseWei Thank u! https://github.com/pohutukawa-2022/gardenz/pull/57