Skip to content

Commit 3645f8c

Browse files
committed
Fix of SSR in auth reducer
1 parent 7805df7 commit 3645f8c

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

package-lock.json

+27-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
2929
"test": "npm run lint && npm run jest"
3030
},
31-
"version": "0.0.6",
31+
"version": "0.0.7",
3232
"dependencies": {
3333
"isomorphic-fetch": "^2.2.1",
3434
"le_node": "^1.7.0",
@@ -42,7 +42,7 @@
4242
"redux": "^3.6.0",
4343
"redux-actions": "^2.0.1",
4444
"tc-accounts": "https://github.com/appirio-tech/accounts-app.git#dev",
45-
"topcoder-react-utils": "^0.3.11"
45+
"topcoder-react-utils": "^0.3.12"
4646
},
4747
"devDependencies": {
4848
"autoprefixer": "^8.2.0",

src/reducers/auth.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,19 @@ function create(initialState) {
7373
* @returns {Promise}
7474
* @resolves {Function(state, action): state} New reducer.
7575
*/
76-
export function factory(options = {}) {
76+
export async function factory(options = {}) {
7777
const state = {
7878
tokenV2: _.get(options.auth, 'tokenV2'),
7979
tokenV3: _.get(options.auth, 'tokenV3'),
8080
};
8181

8282
if (state.tokenV3) {
8383
state.user = decodeToken(state.tokenV3);
84-
return redux.resolveAction(actions.auth.loadProfile(state.tokenV3))
85-
.then(res => create(onProfileLoaded(state, res), options.mergeReducers));
84+
let a = actions.auth.loadProfile(state.tokenV3);
85+
a = await redux.resolveAction(a);
86+
return create(onProfileLoaded(state, a));
8687
}
87-
return Promise.resolve(create(state, options.mergeReducers));
88+
return create(state);
8889
}
8990

9091
/**

0 commit comments

Comments
 (0)