jedireza / aqua

:bulb: A website and user system starter
https://jedireza.github.io/aqua/
MIT License
1.38k stars 356 forks source link

filter-form-hoc #212

Closed walshe closed 7 years ago

walshe commented 7 years ago

curious what does 'hoc' mean ?

jedireza commented 7 years ago

I'm glad you asked. It means higher-order component. 🖖

https://facebook.github.io/react/docs/higher-order-components.html

walshe commented 7 years ago

ah I see, nice :) btw would be nice to have some sort of error handling when for example an api component encounters an error.

jedireza commented 7 years ago

There are different kinds of errors.

If we actually get a response from the server it's caught here and handed back to the caller (usually actions): https://github.com/jedireza/aqua/blob/b3072fa11748a50ffbc16e0aee71ceca316c0cc2/client/helpers/json-fetch.js#L38-L58

We created some proxy functions for calling the API here: https://github.com/jedireza/aqua/blob/b3072fa11748a50ffbc16e0aee71ceca316c0cc2/client/actions/api.js

And these functions can take a callback as seen here: https://github.com/jedireza/aqua/blob/b3072fa11748a50ffbc16e0aee71ceca316c0cc2/client/pages/login/actions.js#L32-L47

So you should have everything you need to catch errors.

jedireza commented 7 years ago

Oh and let's not forget that the redux stores often use the ParseValidation helper here: https://github.com/jedireza/aqua/blob/b3072fa11748a50ffbc16e0aee71ceca316c0cc2/client/pages/contact/store.js#L24

walshe commented 7 years ago

ah super, thanks