Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall great job! :) Looking forward to see the rest of implementation
src/api/api-client.js
Outdated
// If everything went fine just return the result | ||
return response.json() | ||
} catch (e) { | ||
// TODO: redirect to login |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of guest token the redirect is actually not correct behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that in some cases this might lead to an infinite loop? 🤔Maybe when a user tries to log in with incorrect credentials? A possible fix would be something like this:
const makeRequest = (url, options, token, isRetried)
(and ignore the call if retried)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log in and singup are done without this api client so that should not be problem. We need to rethrow error so async validation can kick in later and handle just special cases (like second 401 with logout etc.)
src/App.js
Outdated
@@ -1,16 +1,20 @@ | |||
import React from 'react' | |||
import { Switch, Route, Redirect } from 'react-router-dom' | |||
import { Provider } from 'react-redux' | |||
import { ToastContainer, toast } from 'react-toastify' | |||
import 'react-toastify/dist/ReactToastify.css' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's put that into globalStyles.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Closed in favor of #14 |
I need to finish error handling tomorrow but please feel free to provide any feedback :)