Skip to content

Commit

Permalink
chore: Log event of server/token logout to help tracking bugs (#5716)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolmello authored Jun 3, 2024
1 parent 354ffb5 commit 5728cba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/lib/methods/helpers/log/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export default {
// LOGIN VIEW
LOGIN_DEFAULT_LOGIN: 'login_default_login',
LOGIN_DEFAULT_LOGIN_F: 'login_default_login_f',
LOGOUT_BY_SERVER: 'logout_by_server',
LOGOUT_TOKEN_EXPIRED: 'logout_token_expired',

// FORGOT PASSWORD VIEW
FP_FORGOT_PASSWORD: 'fp_forgot_password',
Expand Down
2 changes: 2 additions & 0 deletions app/sagas/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ const handleLoginRequest = function* handleLoginRequest({
}
} catch (e) {
if (e?.data?.message && /you've been logged out by the server/i.test(e.data.message)) {
logEvent(events.LOGOUT_BY_SERVER);
yield put(logoutAction(true, 'Logged_out_by_server'));
} else if (e?.data?.message && /your session has expired/i.test(e.data.message)) {
logEvent(events.LOGOUT_TOKEN_EXPIRED);
yield put(logoutAction(true, 'Token_expired'));
} else {
logEvent(events.LOGIN_DEFAULT_LOGIN_F);
Expand Down

0 comments on commit 5728cba

Please sign in to comment.