clean-logout.s
Owner: Louis Lagrange
Checks
You should remove all persisted and in-memory user content after a logout. You should logout from every external services silently.
If my project uses
react-apollo
the cache is cleared with client.resetStore
If my project uses
redux
there is a
LOGOUT
orRESET_CUSTOMER_DATA
action that replaces the user reducers' states with the initial states
If my project uses React-Native
AsyncStorage
the cache is cleared with AsyncStorage.clear, or AsyncStorage.multiRemove if you need to target only some keys.
Errors should be caught and handled
Good examples
Bad examples
Example 1
Without cleaning the user data, you will have state and data inconsistencies with the new user.
Example 2
Without the try catch
, the app will crash if the user has no connection, or if another error happens.
Last updated