Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for the proper removal of a set subjectId #64

Merged
merged 1 commit into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/screens/login/loginActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,19 @@ export const sendCredentials =
// reactivates the camera
if (camera) camera.reactivate();
// persists the error
dispatch(sendCredentialsFail(err));
dispatch(sendCredentialsFail({
loginError: err.error ?? textConf.login.errorUserGeneric,
loginUnauthorized: err.error?.response?.status === 401
}));
});
} else {
// reactivates the camera
if (camera) camera.reactivate();
// persists a generic error
dispatch(sendCredentialsFail(textConf.login.noSubjectId));
dispatch(sendCredentialsFail({
loginError: textConf.login.noSubjectId,
loginUnauthorized: false
}));
}
};

Expand Down
20 changes: 10 additions & 10 deletions src/screens/login/loginReducer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// (C) Copyright IBM Deutschland GmbH 2021. All rights reserved.

/***********************************************************************************************
Expand Down Expand Up @@ -49,15 +50,14 @@ const actionHandlers = {
* @param {object} state redux state
* @param {object} values values to be set
*/
SEND_CREDENTIALS_FAIL: (state, values) => ({
...state,
loginError: values.error,
loading: false,
loginUnauthorized:
values.error.response &&
values.error.response.status &&
values.error.response.status === 401,
}),
SEND_CREDENTIALS_FAIL: (state, values) => (
{
...state,
...values,
subjectId: null,
loading: false
}
),

/**
* just updates the subjectId
Expand Down Expand Up @@ -91,7 +91,7 @@ const actionHandlers = {
*/
LOGOUT: (state) => ({
...state,
subjectId: "",
subjectId: null,
session: null,
loginError: null,
loggedIn: false,
Expand Down