Skip to content

Commit

Permalink
fix: iOS login (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
vhu-axelor authored and lme-axelor committed Jun 14, 2024
1 parent 8a49cde commit af6f3dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/features/authSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {testUrl} from '../utils/api';

export const login = createAsyncThunk(
'auth/login',
async ({url, username, password}) => {
async ({url, username, password, closePopup}) => {
const urlWithProtocol = await testUrl(url);
const {token, jsessionId, requestInterceptorId, responseInterceptorId} =
await loginApi(urlWithProtocol, username, password);
Expand All @@ -36,6 +36,8 @@ export const login = createAsyncThunk(

apiProviderConfig.setSessionExpired(false);

closePopup?.();

return {
url: urlWithProtocol,
token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ const PopupCreateSession = ({

const onPressLogin = useCallback(
session => {
dispatch(login({...session})).then(res => {
dispatch(
login({...session, closePopup: () => handleVisibility(false)}),
).then(res => {
if (res.error == null && isMounted) {
sessionStorage.registerSession({
session,
});
handleVisibility(false);
}
});
},
Expand Down
7 changes: 2 additions & 5 deletions packages/core/src/sessions/components/alerts/PopupSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ const PopupSession = ({
url: sessionActive.url,
username: sessionActive.username,
password,
closePopup: () => setIsOpen(false),
}),
).then(res => {
if (res.error == null) {
setIsOpen(false);
}
});
);
},
[dispatch, sessionActive],
);
Expand Down

0 comments on commit af6f3dd

Please sign in to comment.