Skip to content

Commit

Permalink
v3.0.0-beta.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilian Mantz committed Mar 27, 2017
1 parent 28427b2 commit b8f7f7b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/redux-oidc.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-oidc",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "A package for managing OpenID Connect authentication in redux apps",
"main": "dist/redux-oidc.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/oidcMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function errorCallback(error) {

// the middleware handler function
export function* middlewareHandler(next, action, userManager) {
// prevent an infinite loop of disptaches of these action types (issue #30)
// prevent an infinite loop of dispatches of these action types (issue #30)
if (action.type === USER_EXPIRED || action.type === LOADING_USER) {
return next(action);
}
Expand Down
7 changes: 5 additions & 2 deletions src/reducer/reducer-immutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ try {
isLoadingUser: false
});
case SILENT_RENEW_ERROR:
return state.set('isLoadingUser', false);
return fromJS({
user: null,
isLoadingUser: false
});
case SESSION_TERMINATED:
case USER_SIGNED_OUT:
return fromJS({
Expand All @@ -48,7 +51,7 @@ try {
};
} catch (error) {
reducer = () => {
console.error("You must install immutable-js for this to work!");
console.error("You must install immutable-js for the immutable reducer to work!");
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/reducer/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function reducer(state = initialState, action) {
case USER_EXPIRED:
return Object.assign({}, { ...state }, { user: null, isLoadingUser: false });
case SILENT_RENEW_ERROR:
return Object.assign({}, { ...state }, { isLoadingUser: false });
return Object.assign({}, { ...state }, { user: null, isLoadingUser: false });
case SESSION_TERMINATED:
case USER_SIGNED_OUT:
return Object.assign({}, { ...state }, { user: null, isLoadingUser: false });
Expand Down
7 changes: 6 additions & 1 deletion tests/reducer/reducer-immutable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ describe('immutable reducer', () => {
});

it('should handle SILENT_RENEW_ERROR correctly', () => {
const oldState = fromJS({
user: { some: 'user' },
isLoadingUser: true
});

const expectedResult = fromJS({
user: null,
isLoadingUser: false
});

expect(reducer(fromJS(initialState), silentRenewError())).toEqual(expectedResult);
expect(reducer(fromJS(oldState), silentRenewError())).toEqual(expectedResult);
});

it('should handle REDIRECT_SUCCESS correctly', () => {
Expand Down
7 changes: 6 additions & 1 deletion tests/reducer/reducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ describe('reducer', () => {
});

it('should handle SILENT_RENEW_ERROR correctly', () => {
const oldState = {
user: { some: 'user' },
isLoadingUser: true
};

const expectedResult = {
user: null,
isLoadingUser: false
};

expect(reducer(initialState, silentRenewError())).toEqual(expectedResult);
expect(reducer(oldState, silentRenewError())).toEqual(expectedResult);
});

it('should handle REDIRECT_SUCCESS correctly', () => {
Expand Down

0 comments on commit b8f7f7b

Please sign in to comment.