Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

added saga logouts

Blue Mouse23a1c83699a5
diff --git a/src/App.tsx b/src/App.tsx
index e70129c92..e1737ec8d 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -23,6 +23,7 @@ import {
} from 'redux/constants'
import { getAccessToken } from 'utils/accessToken'
import { authActions } from 'redux/reducers/auth'
+import sagaActions from 'redux/sagas/actions'
import { errorsActions } from 'redux/reducers/errors'
import { alertsActions } from 'redux/reducers/alerts'
import { StateType, useAppDispatch } from 'redux/store'
@@ -149,6 +150,7 @@ const App = () => {
dispatch(authActions.finishLoading())
} catch (e) {
dispatch(authActions.logout())
+ dispatch(sagaActions.logout(false))
}
}
})()
diff --git a/src/api/index.ts b/src/api/index.ts
index 9e9c1522c..caf57f788 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -6,8 +6,9 @@ import Debug from 'debug'
import _map from 'lodash/map'
import _isEmpty from 'lodash/isEmpty'
import _isArray from 'lodash/isArray'
-import { authActions } from 'redux/reducers/auth'
+import { authActions } from 'redux/reducers/auth'
+import sagaActions from 'redux/sagas/actions'
import { getAccessToken, removeAccessToken, setAccessToken } from 'utils/accessToken'
import { getRefreshToken, removeRefreshToken } from 'utils/refreshToken'
import { DEFAULT_ALERTS_TAKE, isSelfhosted } from 'redux/constants'
@@ -43,6 +44,7 @@ const refreshAuthLogic = (failedRequest: { response: AxiosResponse }) =>
})
.catch((error) => {
store.dispatch(authActions.logout())
+ store.dispatch(sagaActions.logout(true))
return Promise.reject(error)
})
diff --git a/src/pages/MainPage/Pricing.tsx b/src/pages/MainPage/Pricing.tsx
index ca3b99f1a..2f9c56ad4 100644
--- a/src/pages/MainPage/Pricing.tsx
+++ b/src/pages/MainPage/Pricing.tsx
@@ -16,6 +16,7 @@ import { CONTACT_EMAIL, paddleLanguageMapping, PLAN_LIMITS } from 'redux/constan
import { errorsActions } from 'redux/reducers/errors'
import { alertsActions } from 'redux/reducers/alerts'
import { authActions } from 'redux/reducers/auth'
+import sagaActions from 'redux/sagas/actions'
import { authMe } from 'api'
import routes from 'routes'
import { IUser } from 'redux/models/IUser'
@@ -292,6 +293,7 @@ const Pricing = ({ t, language }: {
dispatch(authActions.finishLoading())
} catch (e) {
dispatch(authActions.logout())
+ dispatch(sagaActions.logout(false))
}
dispatch(alertsActions.accountUpdated({