mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 20:53:24 +10:00
Merge pull request #521 from sharetribe/fix-auth-logout-error
Fix error when data was being loaded while logout was in progress
This commit is contained in:
commit
610ee43751
2 changed files with 6 additions and 5 deletions
|
|
@ -151,15 +151,16 @@ export const logout = () => (dispatch, getState, sdk) => {
|
|||
}
|
||||
dispatch(logoutRequest());
|
||||
|
||||
// Not that the thunk does not reject when the logout fails, it
|
||||
// Note that the thunk does not reject when the logout fails, it
|
||||
// just dispatches the logout error action.
|
||||
return sdk
|
||||
.logout()
|
||||
.then(() => dispatch(clearCurrentUser()))
|
||||
.then(() => dispatch(logoutSuccess()))
|
||||
.then(() => {
|
||||
dispatch(userLogout());
|
||||
// The order of the dispatched actions
|
||||
dispatch(logoutSuccess());
|
||||
dispatch(clearCurrentUser());
|
||||
log.clearUserId();
|
||||
dispatch(userLogout());
|
||||
})
|
||||
.catch(e => dispatch(logoutError(storableError(e))));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -274,8 +274,8 @@ describe('Auth duck', () => {
|
|||
expect(sdk.logout.mock.calls.length).toEqual(1);
|
||||
expect(dispatch.mock.calls).toEqual([
|
||||
[logoutRequest()],
|
||||
[clearCurrentUser()],
|
||||
[logoutSuccess()],
|
||||
[clearCurrentUser()],
|
||||
[userLogout()],
|
||||
]);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue