Refactor shipments list with Rest Hooks
I'm adding rest-hooks
(https://resthooks.io/) to simplify managing REST resources. It integrates seamlessly with Redux, so we don't have to touch any of the existing code. Rest Hooks takes care of fetching and caching resources. It works hand in hand with React Suspense and Error Boundaries to manage loading and error states.
Note that I had to move the Redux store code in a separate file so I could import it in the ShipmentResource
to retrieve the sessionId
.
I've also fixed all ocurrences of class
instead of className
in JSX, and I've moved checks of this.props.user.sessionId
in the router so that the routes are only rendered if the user is authenticated.
Edited by Axel Bocciarelli