-
I would use
localStorage.setItem('token', 'xyz')
andlocalStorage.getItem('token')
for storing the auth token. Your current solution works, but it's considered less secure for some browsers (here's an article on SO) -
I would consider adding
window.devToolsExtension()
to support the Redux chrome extension – an example of how we do it -
Organize imports according to Plaid JS style guide
-
You can create a new object by doing:
return { ...state, hashId: action.parsedToken, }; // instead of return Object.assign({}, state, { hashId: action.parsedToken, });
-
You should set default state by doing the following. By default
state
will beundefined
so will default toINITIAL_STATE
const INITIAL_STATE = { parsedToken: {}, item: {}, error: {}, }; const itemReducer = (state = INITIAL_STATE, action) => { // ... rest of reducer }
-
I would consider using axios over jQuery's
ajax
method. It is a very small library, uses native promises when available, and allows you to remove jQuery entirely :) -
Actions which return an object can be shortened to:
export const requestParseAccessTokenComplete = (payload, cmpName) => ({ type: 'REQUEST_PARSE_ACCESS_TOKEN_COMPLETE', parsedToken: {[cmpName]: payload}, });
Last active
August 29, 2016 18:08
-
-
Save pbernasconi/5c47b008f8cc785f3107f46a99d86fb1 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment