diff --git a/app/client/src/actions/userActions.ts b/app/client/src/actions/userActions.ts index de3b81aedf..2a5c5be09e 100644 --- a/app/client/src/actions/userActions.ts +++ b/app/client/src/actions/userActions.ts @@ -15,12 +15,6 @@ export const logoutUserError = (error: any) => ({ error, }, }); - -export const fetchCurrentUser = () => ({ - type: ReduxActionTypes.FETCH_USER_INIT, - payload: CurrentUserDetailsRequestPayload, -}); - export const setCurrentUserDetails = () => ({ type: ReduxActionTypes.SET_CURRENT_USER_INIT, payload: CurrentUserDetailsRequestPayload, diff --git a/app/client/src/pages/common/AppRoute.tsx b/app/client/src/pages/common/AppRoute.tsx index f966c79e01..506ad17d5c 100644 --- a/app/client/src/pages/common/AppRoute.tsx +++ b/app/client/src/pages/common/AppRoute.tsx @@ -32,11 +32,6 @@ const AppRoute = ({ location?: any; }) => { const dispatch = useDispatch(); - useEffect(() => { - if (!/^\/user\/\w+/.test(rest.location.pathname)) { - dispatch(setCurrentUserDetails()); - } - }, [rest.name, rest.location.pathname, dispatch]); useEffect(() => { if (!rest.logDisable) { diff --git a/app/client/src/sagas/userSagas.tsx b/app/client/src/sagas/userSagas.tsx index c4cabaec48..bfd4b4f55f 100644 --- a/app/client/src/sagas/userSagas.tsx +++ b/app/client/src/sagas/userSagas.tsx @@ -29,7 +29,6 @@ import { fetchOrgsSaga } from "./OrgSagas"; import { resetAuthExpiration } from "utils/storage"; import { logoutUserSuccess, - fetchCurrentUser, logoutUserError, verifyInviteSuccess, verifyInviteError, @@ -262,51 +261,6 @@ export function* verifyUserInviteSaga(action: ReduxAction) { } } -export function* fetchUserSaga(action: ReduxAction) { - try { - const request: FetchUserRequest = action.payload; - const response: FetchUserResponse = yield call(UserApi.fetchUser, request); - const isValidResponse = yield validateResponse(response); - - if (isValidResponse) { - const { user, applications, currentOrganization } = response.data; - const finalData = { - ...user, - applications, - currentOrganization, - }; - AnalyticsUtil.identifyUser(finalData.id, finalData); - Sentry.configureScope(function(scope) { - scope.setUser({ email: finalData.email, id: finalData.id }); - }); - yield put({ - type: ReduxActionTypes.FETCH_USER_SUCCESS, - payload: finalData, - }); - return yield finalData; - } - return yield false; - } catch (error) { - console.log(error); - yield put({ - type: ReduxActionErrorTypes.FETCH_USER_ERROR, - payload: error, - }); - } -} - -export function* setCurrentUserSaga(action: ReduxAction) { - const me = yield call(fetchUserSaga, action); - if (me) { - resetAuthExpiration(); - yield put({ - type: ReduxActionTypes.SET_CURRENT_USER_SUCCESS, - payload: me, - }); - yield call(fetchOrgsSaga); - } -} - export function* switchUserOrgSaga(action: ReduxAction) { try { const request: SwitchUserOrgRequest = action.payload; @@ -362,7 +316,6 @@ export function* logoutSaga() { if (isValidResponse) { AnalyticsUtil.reset(); yield put(logoutUserSuccess()); - yield put(fetchCurrentUser()); } } catch (error) { console.log(error); @@ -380,8 +333,6 @@ export default function* userSagas() { verifyResetPasswordTokenSaga, ), takeLatest(ReduxActionTypes.INVITE_USERS_TO_ORG_INIT, inviteUsers), - takeLatest(ReduxActionTypes.FETCH_USER_INIT, fetchUserSaga), - takeLatest(ReduxActionTypes.SET_CURRENT_USER_INIT, setCurrentUserSaga), takeLatest(ReduxActionTypes.LOGOUT_USER_INIT, logoutSaga), takeLatest(ReduxActionTypes.VERIFY_INVITE_INIT, verifyUserInviteSaga), takeLatest(