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!

fix: lint

Blue Mouse90c5238eeec7
diff --git a/web/app/pages/Onboarding/Onboarding.tsx b/web/app/pages/Onboarding/Onboarding.tsx
index 1e19ce5a4..4b2edaed1 100644
--- a/web/app/pages/Onboarding/Onboarding.tsx
+++ b/web/app/pages/Onboarding/Onboarding.tsx
@@ -244,7 +244,7 @@ const Onboarding = () => {
<nav aria-label='Progress' className='p-4'>
<ol className='space-y-1'>
- {steps.map((step, stepIdx) => {
+ {steps.map((step) => {
if (step.uiHidden) return null
const status = step.completed ? 'complete' : step.current ? 'current' : 'upcoming'
diff --git a/web/app/pages/Unsubscribe/index.tsx b/web/app/pages/Unsubscribe/index.tsx
index e0b6af2c1..42b715a26 100644
--- a/web/app/pages/Unsubscribe/index.tsx
+++ b/web/app/pages/Unsubscribe/index.tsx
@@ -16,44 +16,26 @@ const Unsubscribe = ({ type }: UnsubscribeProps) => {
const { t } = useTranslation('common')
const { token } = useParams()
const { isAuthenticated } = useAuth()
- const [loading, setLoading] = useState(true)
- const [error, setError] = useState('')
- useEffect(() => {
- setLoading(true)
+ const isValidToken = _isString(token)
+ const [loading, setLoading] = useState(isValidToken)
+ const [error, setError] = useState(isValidToken ? '' : t('apiNotifications.invalidToken'))
- if (!_isString(token)) {
- setError(t('apiNotifications.invalidToken'))
- setLoading(false)
+ useEffect(() => {
+ if (!isValidToken) {
return
}
- if (type === 'user-reports') {
- unsubscribeFromEmailReports(token)
- .then(() => {
- setLoading(false)
- })
- .catch((reason) => {
- setError(_isString(reason) ? reason : reason?.response?.data?.message || reason.message)
- })
- .finally(() => {
- setLoading(false)
- })
- }
+ const apiCall = type === 'user-reports' ? unsubscribeFromEmailReports : unsubscribeFromEmailReports3rdParty
- if (type === '3rdparty') {
- unsubscribeFromEmailReports3rdParty(token)
- .then(() => {
- setLoading(false)
- })
- .catch((reason) => {
- setError(_isString(reason) ? reason : reason?.response?.data?.message || reason.message)
- })
- .finally(() => {
- setLoading(false)
- })
- }
- }, [token, type]) // eslint-disable-line
+ apiCall(token)
+ .catch((reason) => {
+ setError(_isString(reason) ? reason : reason?.response?.data?.message || reason.message)
+ })
+ .finally(() => {
+ setLoading(false)
+ })
+ }, [token, type, isValidToken])
const primaryAction = isAuthenticated
? { label: t('common.dashboard'), to: routes.dashboard, primary: true }