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!

Remove debug module

Blue Mousebac26ae06110
diff --git a/web/app/api/ai.ts b/web/app/api/ai.ts
index 8dd41f294..71bdaf5cb 100644
--- a/web/app/api/ai.ts
+++ b/web/app/api/ai.ts
@@ -1,11 +1,8 @@
/* eslint-disable implicit-arrow-linebreak */
import axios from 'axios'
-import Debug from 'debug'
import _isEmpty from 'lodash/isEmpty'
import { AIAPI_URL } from 'redux/constants'
-const debug = Debug('swetrix:ai')
-
const api = axios.create({
baseURL: AIAPI_URL,
})
@@ -27,6 +24,5 @@ export const getChartPrediction = (chart: any, periodToForecast: any, frequency:
})
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
diff --git a/web/app/api/index.ts b/web/app/api/index.ts
index 791fdffd7..50650e8b7 100644
--- a/web/app/api/index.ts
+++ b/web/app/api/index.ts
@@ -2,7 +2,6 @@
import axios, { AxiosResponse } from 'axios'
import createAuthRefreshInterceptor from 'axios-auth-refresh'
import { store } from 'redux/store'
-import Debug from 'debug'
import _map from 'lodash/map'
import _isEmpty from 'lodash/isEmpty'
import _isArray from 'lodash/isArray'
@@ -21,8 +20,6 @@ import { IFilter, IProjectViewCustomEvent } from 'pages/Project/View/interfaces/
import { AIResponse } from 'pages/Project/View/interfaces/ai'
import { Monitor, MonitorOverall } from 'redux/models/Uptime'
-const debug = Debug('swetrix:api')
-
const api = axios.create({
baseURL: API_URL,
})
@@ -72,7 +69,6 @@ export const authMe = () =>
.get('user/me')
.then((response): IUser => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -89,7 +85,6 @@ export const logoutApi = (refreshToken: string | null) =>
return response.data
})
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -98,7 +93,6 @@ export const logoutAllApi = () =>
.post(`${API_URL}v1/auth/logout-all`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw new Error(error.respon)
})
@@ -107,7 +101,6 @@ export const login = (credentials: { email: string; password: string }) =>
.post('v1/auth/login', credentials)
.then((response): IAuth => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -200,7 +193,6 @@ export const forgotPassword = (email: { email: string }) =>
.post('v1/auth/reset-password', email)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -209,7 +201,6 @@ export const confirmEmail = () =>
.post('/user/confirm_email')
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -218,7 +209,6 @@ export const exportUserData = () =>
.get('/user/export')
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -239,7 +229,6 @@ export const verifyEmail = ({ id }: { id: string }) =>
.get(`v1/auth/verify-email/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -248,7 +237,6 @@ export const confirmChangeEmail = ({ id }: { id: string }) =>
.get(`v1/auth/change-email/confirm/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -257,7 +245,6 @@ export const verifyShare = ({ path, id }: { path: string; id: string }) =>
.get(`/project/${path}/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -275,7 +262,6 @@ export const getProjects = (take: number = 0, skip: number = 0, search?: string)
} => response.data,
)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -284,7 +270,6 @@ export const getOrganisations = (take: number = 0, skip: number = 0, search?: st
.get(`/organisation?take=${take}&skip=${skip}&search=${search}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -293,7 +278,6 @@ export const getOrganisation = (id: string) =>
.get(`/organisation/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -302,7 +286,6 @@ export const createOrganisation = (name: string) =>
.post('/organisation', { name })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -311,7 +294,6 @@ export const addProjectToOrganisation = (organisationId: string, projectId: stri
.post(`/project/organisation/${organisationId}`, { projectId })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -320,7 +302,6 @@ export const removeProjectFromOrganisation = (organisationId: string, projectId:
.delete(`/project/organisation/${organisationId}/${projectId}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -334,7 +315,6 @@ export const getProject = (pid: string, isCaptcha: boolean = false, password?: s
})
.then((response): IProject => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -343,7 +323,6 @@ export const createProject = (data: { name: string; organisationId?: string; isC
.post('/project', data)
.then((response): IProject => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -352,7 +331,6 @@ export const updateProject = (id: string, data: Partial<IProject>) =>
.put(`/project/${id}`, data)
.then((response): IProject => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -361,7 +339,6 @@ export const deleteProject = (id: string) =>
.delete(`/project/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -370,7 +347,6 @@ export const deleteCaptchaProject = (id: string) =>
.delete(`project/captcha/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -379,7 +355,6 @@ export const resetProject = (id: string) =>
.delete(`/project/reset/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -388,7 +363,6 @@ export const resetCaptchaProject = (id: string) =>
.delete(`project/captcha/reset/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -417,7 +391,6 @@ export const getProjectData = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -442,7 +415,6 @@ export const getCustomEventsMetadata = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -470,7 +442,6 @@ export const getPropertyMetadata = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -498,7 +469,6 @@ export const getTrafficCompareData = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -526,7 +496,6 @@ export const getPerformanceCompareData = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -554,7 +523,6 @@ export const getPerfData = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -582,7 +550,6 @@ export const getSessions = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -611,7 +578,6 @@ export const getErrors = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -624,7 +590,6 @@ export const getSession = (pid: string, psid: string, timezone: string = '', pas
})
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -649,7 +614,6 @@ export const getError = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error.response
})
@@ -670,7 +634,6 @@ export const getFunnelData = (
})
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -683,7 +646,6 @@ export const getFunnels = (pid: string, password: string | undefined = '') =>
})
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -696,7 +658,6 @@ export const getProjectViews = (pid: string, password: string | undefined = '')
})
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -711,7 +672,6 @@ export const createProjectView = (
.post(`project/${pid}/views`, { name, type, filters, customEvents })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -726,7 +686,6 @@ export const updateProjectView = (
.patch(`project/${pid}/views/${viewId}`, { name, filters, customEvents })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -735,7 +694,6 @@ export const deleteProjectView = (pid: string, viewId: string) =>
.delete(`project/${pid}/views/${viewId}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -755,7 +713,6 @@ export const getCaptchaData = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -781,7 +738,6 @@ export const getOverallStats = (
)
.then((response): IOverall => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -808,7 +764,6 @@ export const getPerformanceOverallStats = (
)
.then((response): IOverall => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -828,7 +783,6 @@ export const getOverallStatsCaptcha = (
)
.then((response): IOverall => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -841,7 +795,6 @@ export const getLiveVisitors = (pids: string[], password?: string) =>
})
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -850,7 +803,6 @@ export const getGeneralStats = () =>
.get('log/generalStats')
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -865,7 +817,6 @@ export const shareProject = (
.post(`/project/${pid}/share`, data)
.then((response): IProject => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -874,7 +825,6 @@ export const deleteShareProjectUsers = (pid: string, userId: string) =>
.delete(`/project/${pid}/${userId}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -883,7 +833,6 @@ export const deleteShareProject = (pid: string) =>
.delete(`user/share/${pid}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -892,7 +841,6 @@ export const acceptShareProject = (id: string) =>
.get(`user/share/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -906,7 +854,6 @@ export const changeShareRole = (
.put(`project/share/${id}`, data)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -915,7 +862,6 @@ export const generate2FA = () =>
.post('2fa/generate')
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -924,7 +870,6 @@ export const enable2FA = (twoFactorAuthenticationCode: string) =>
.post('2fa/enable', { twoFactorAuthenticationCode })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -933,7 +878,6 @@ export const disable2FA = (twoFactorAuthenticationCode: string) =>
.post('2fa/disable', { twoFactorAuthenticationCode })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -942,7 +886,6 @@ export const submit2FA = (twoFactorAuthenticationCode: string) =>
.post('2fa/authenticate', { twoFactorAuthenticationCode })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -957,7 +900,6 @@ export const generateApiKey = () =>
} => response.data,
)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -966,7 +908,6 @@ export const deleteApiKey = () =>
.delete('user/api-key')
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -975,7 +916,6 @@ export const getInstalledExtensions = (limit = 100, offset = 0) =>
.get(`/extensions/installed?limit=${limit}&offset=${offset}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -996,7 +936,6 @@ export const getLiveVisitorsInfo = (pid: string, password?: string) =>
})
.then((response): IGetLiveVisitorsInfo[] => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1005,7 +944,6 @@ export const removeTgIntegration = (tgID: string) =>
.delete(`user/tg/${tgID}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1022,7 +960,6 @@ export const getAlerts = (take: number = DEFAULT_ALERTS_TAKE, skip: number = 0)
} => response.data,
)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1033,7 +970,6 @@ export const createAlert = (data: ICreateAlert) =>
.post('alert', data)
.then((response): IAlerts => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1042,7 +978,6 @@ export const updateAlert = (id: string, data: Partial<IAlerts>) =>
.put(`alert/${id}`, data)
.then((response): IAlerts => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1051,7 +986,6 @@ export const deleteAlert = (id: string) =>
.delete(`alert/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1070,7 +1004,6 @@ export const getAllMonitors = (take: number = DEFAULT_MONITORS_TAKE, skip: numbe
} => response.data,
)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1087,7 +1020,6 @@ export const getProjectMonitors = (projectId: string, take: number = DEFAULT_MON
} => response.data,
)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1113,7 +1045,6 @@ export const getMonitorOverallStats = (
)
.then((response): MonitorOverall => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1138,7 +1069,6 @@ export const getMonitorStats = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1147,7 +1077,6 @@ export const createMonitor = (pid: string, data: ICreateMonitor) =>
.post(`project/${pid}/monitor`, data)
.then((response): Monitor => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1156,7 +1085,6 @@ export const updateMonitor = (pid: string, id: string, data: Partial<Monitor>) =
.patch(`project/${pid}/monitor/${id}`, data)
.then((response): Monitor => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1165,7 +1093,6 @@ export const deleteMonitor = (pid: string, id: string) =>
.delete(`project/${pid}/monitor/${id}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1174,7 +1101,6 @@ export const reGenerateCaptchaSecretKey = (pid: string) =>
.post(`project/secret-gen/${pid}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1189,7 +1115,6 @@ export const addSubscriber = (
.post(`project/${id}/subscribers`, data)
.then((response): ISubscribers => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1198,7 +1123,6 @@ export const addFunnel = (pid: string, name: string, steps: string[]) =>
.post('project/funnel', { pid, name, steps })
.then((response): any => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1207,7 +1131,6 @@ export const updateFunnel = (id: string, pid: string, name: string, steps: strin
.patch('project/funnel', { id, name, steps, pid })
.then((response): any => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1216,7 +1139,6 @@ export const deleteFunnel = (id: string, pid: string) =>
.delete(`project/funnel/${id}/${pid}`)
.then((response): any => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1232,7 +1154,6 @@ export const getSubscribers = (id: string, offset: number, limit: number) =>
} => response.data,
)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1247,7 +1168,6 @@ export const updateSubscriber = (
.patch(`project/${id}/subscribers/${subscriberId}`, data)
.then((response): ISubscribers => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1256,7 +1176,6 @@ export const removeSubscriber = (id: string, subscriberId: string) =>
.delete(`project/${id}/subscribers/${subscriberId}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1265,7 +1184,6 @@ export const confirmSubscriberInvite = (id: string, token: string) =>
.get(`project/${id}/subscribers/invite?token=${token}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1293,7 +1211,6 @@ export const getProjectDataCustomEvents = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1305,7 +1222,6 @@ export const transferProject = (uuid: string, email: string) =>
})
.then((response): unknown => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1314,7 +1230,6 @@ export const rejectTransferProject = (uuid: string) =>
.delete(`project/transfer?token=${uuid}`)
.then((response): unknown => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1323,7 +1238,6 @@ export const confirmTransferProject = (uuid: string) =>
.get(`project/transfer?token=${uuid}`)
.then((response): unknown => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1334,7 +1248,6 @@ export const generateSSOAuthURL = (provider: string) =>
})
.then((response): unknown => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1343,7 +1256,6 @@ export const getJWTBySSOHash = (hash: string, provider: string, refCode?: string
.post('v1/auth/sso/hash', { hash, provider, refCode })
.then((response): unknown => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1352,7 +1264,6 @@ export const linkBySSOHash = (hash: string, provider: string) =>
.post('v1/auth/sso/link_by_hash', { hash, provider })
.then((response): unknown => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1361,7 +1272,6 @@ export const unlinkSSO = (provider: string) =>
.delete('v1/auth/sso/unlink', { data: { provider } })
.then((response): unknown => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1370,7 +1280,6 @@ export const processSSOToken = (token: string, hash: string) =>
.post('v1/auth/sso/process-token', { token, hash })
.then((response): unknown => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1385,7 +1294,6 @@ export const deletePartially = (
.delete(`project/partially/${id}?from=${data.from}&to=${data.to}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1412,7 +1320,6 @@ export const getUserFlow = (
)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1425,7 +1332,6 @@ export const checkPassword = (pid: string, password: string) =>
})
.then((response): Boolean => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1434,7 +1340,6 @@ export const getPaymentMetainfo = () =>
.get('user/metainfo')
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1443,7 +1348,6 @@ export const getUsageInfo = () =>
.get('user/usageinfo')
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1456,7 +1360,6 @@ export const getFilters = (pid: string, type: string, password = '') =>
})
.then((response): string[] => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1469,7 +1372,6 @@ export const getErrorsFilters = (pid: string, type: string, password = '') =>
})
.then((response): string[] => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1478,7 +1380,6 @@ export const resetFilters = (pid: string, type: string, filters: string[]) =>
.delete(`project/reset-filters/${pid}?type=${type}&filters=${JSON.stringify(filters)}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1487,7 +1388,6 @@ export const receiveLoginNotification = (receiveLoginNotifications: boolean) =>
.post('user/recieve-login-notifications', { receiveLoginNotifications })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1496,7 +1396,6 @@ export const setPaypalEmail = (paypalPaymentsEmail: string | null) =>
.patch('user/set-paypal-email', { paypalPaymentsEmail })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1505,7 +1404,6 @@ export const previewSubscriptionUpdate = (planId: number) =>
.post('user/preview-plan', { planId })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1514,7 +1412,6 @@ export const changeSubscriptionPlan = (planId: number) =>
.post('user/change-plan', { planId })
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1523,7 +1420,6 @@ export const getBlogPosts = () =>
.get('v1/blog')
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1532,7 +1428,6 @@ export const getBlogPost = (slug: string) =>
.get(`v1/blog/${slug}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1541,7 +1436,6 @@ export const getSitemap = () =>
.get('v1/blog/sitemap')
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1550,7 +1444,6 @@ export const getBlogPostWithCategory = (category: string, slug: string) =>
.get(`v1/blog/${category}/${slug}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1566,7 +1459,6 @@ export const getLastPost = () =>
} => response.data,
)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1575,7 +1467,6 @@ export const unsubscribeFromEmailReports = (token: string) =>
.get(`user/unsubscribe/${token}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1584,7 +1475,6 @@ export const unsubscribeFromEmailReports3rdParty = (token: string) =>
.get(`project/unsubscribe/${token}`)
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw error
})
@@ -1593,7 +1483,6 @@ export const updateErrorStatus = (pid: string, status: 'resolved' | 'active', ei
.patch('log/error-status', { pid, eid, eids, status })
.then((response): any => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
@@ -1606,6 +1495,5 @@ export const getDetailsPrediction = (pid: string, password: string | undefined =
})
.then((response) => response.data)
.catch((error) => {
- debug('%s', error)
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
diff --git a/web/app/redux/sagas/auth/workers/logout.ts b/web/app/redux/sagas/auth/workers/logout.ts
index da65a14dc..277bd960a 100644
--- a/web/app/redux/sagas/auth/workers/logout.ts
+++ b/web/app/redux/sagas/auth/workers/logout.ts
@@ -1,13 +1,10 @@
import { call, put } from 'redux-saga/effects'
-import Debug from 'debug'
import UIActions from 'redux/reducers/ui'
import { getRefreshToken, removeRefreshToken } from 'utils/refreshToken'
import { IStats } from '../../../models/IStats'
const { getGeneralStats, logoutApi, logoutAllApi } = require('api')
-const debug = Debug('swetrix:rx:s:logout')
-
export default function* logoutWorker({
payload: { basedOn401Error, isLogoutAll },
}: {
@@ -28,7 +25,7 @@ export default function* logoutWorker({
const stats: IStats = yield call(getGeneralStats)
yield put(UIActions.setGeneralStats(stats))
}
- } catch (e) {
- debug('Error while getting general stats data: %s', e)
+ } catch (reason) {
+ console.error('Error while getting general stats data: ', reason)
}
}
diff --git a/web/app/redux/sagas/ui/initialise.ts b/web/app/redux/sagas/ui/initialise.ts
index b1ccec7e7..dee5ee94c 100644
--- a/web/app/redux/sagas/ui/initialise.ts
+++ b/web/app/redux/sagas/ui/initialise.ts
@@ -1,5 +1,4 @@
import { put, call } from 'redux-saga/effects'
-import Debug from 'debug'
import { getAccessToken } from 'utils/accessToken'
import { getRefreshToken } from 'utils/refreshToken'
@@ -8,8 +7,6 @@ import { isSelfhosted } from 'redux/constants'
import sagaActions from '../actions'
const { getLastPost } = require('api')
-const debug = Debug('swetrix:rx:s:initialise')
-
export default function* initialise() {
try {
const token: string = yield call(getAccessToken)
@@ -31,7 +28,7 @@ export default function* initialise() {
} = yield call(getLastPost)
yield put(UIActions.setLastBlogPost(lastBlogPost))
}
- } catch (e) {
- debug('An error occured whilst initialising: %s', e)
+ } catch (reason) {
+ console.error('An error occured whilst initialising:', reason)
}
}
diff --git a/web/app/redux/sagas/ui/load_alerts.ts b/web/app/redux/sagas/ui/load_alerts.ts
index e27069d05..b2d52adaf 100644
--- a/web/app/redux/sagas/ui/load_alerts.ts
+++ b/web/app/redux/sagas/ui/load_alerts.ts
@@ -1,13 +1,10 @@
import { put, call } from 'redux-saga/effects'
import { toast } from 'sonner'
-import Debug from 'debug'
import _isString from 'lodash/isString'
import UIActions from 'redux/reducers/ui'
import { DEFAULT_ALERTS_TAKE, isSelfhosted } from 'redux/constants'
const { getAlerts } = require('api')
-const debug = Debug('swetrix:rx:s:load-extensions')
-
export default function* loadProjectAlerts({ payload: { take = DEFAULT_ALERTS_TAKE, skip = 0 } }) {
if (isSelfhosted) {
yield put(UIActions.setProjectAlertsLoading(false))
@@ -30,7 +27,7 @@ export default function* loadProjectAlerts({ payload: { take = DEFAULT_ALERTS_TA
if (_isString(message)) {
toast.error(message)
}
- debug('failed to load extensions: %s', message)
+ console.error('failed to load extensions:', message)
} finally {
yield put(UIActions.setProjectAlertsLoading(false))
}
diff --git a/web/app/redux/sagas/ui/load_extensions.ts b/web/app/redux/sagas/ui/load_extensions.ts
index 7a83fa7d3..29e1292ef 100644
--- a/web/app/redux/sagas/ui/load_extensions.ts
+++ b/web/app/redux/sagas/ui/load_extensions.ts
@@ -1,12 +1,9 @@
import { put, call } from 'redux-saga/effects'
-import Debug from 'debug'
import UIActions from 'redux/reducers/ui'
import { isSelfhosted } from 'redux/constants'
const { getInstalledExtensions } = require('api')
-const debug = Debug('swetrix:rx:s:load-extensions')
-
export default function* loadExtensions() {
if (isSelfhosted) {
return
@@ -21,6 +18,6 @@ export default function* loadExtensions() {
// if (_isString(message)) {
// yield put(UIActions.setProjectsError(message))
// }
- debug('failed to load extensions: %s', message)
+ console.error('failed to load extensions:', message)
}
}
diff --git a/web/app/redux/sagas/ui/load_metainfo.ts b/web/app/redux/sagas/ui/load_metainfo.ts
index 6e3180a79..fa07b1e7a 100644
--- a/web/app/redux/sagas/ui/load_metainfo.ts
+++ b/web/app/redux/sagas/ui/load_metainfo.ts
@@ -1,13 +1,10 @@
import { put, call } from 'redux-saga/effects'
-import Debug from 'debug'
import UIActions from 'redux/reducers/ui'
import { isSelfhosted } from 'redux/constants'
import { IMetainfo } from 'redux/models/IMetainfo'
const { getPaymentMetainfo } = require('api')
-const debug = Debug('swetrix:rx:s:metainfo')
-
export default function* loadMetainfo() {
if (isSelfhosted) {
return
@@ -22,6 +19,6 @@ export default function* loadMetainfo() {
// if (_isString(message)) {
// yield put(UIActions.setProjectsError(message))
// }
- debug('failed to load metainfo: %s', message)
+ console.error('failed to load metainfo:', message)
}
}
diff --git a/web/app/redux/sagas/ui/load_projects.ts b/web/app/redux/sagas/ui/load_projects.ts
index 164094388..188e6f221 100644
--- a/web/app/redux/sagas/ui/load_projects.ts
+++ b/web/app/redux/sagas/ui/load_projects.ts
@@ -1,7 +1,6 @@
import { put, call } from 'redux-saga/effects'
import _map from 'lodash/map'
import _isString from 'lodash/isString'
-import Debug from 'debug'
import { getAccessToken } from 'utils/accessToken'
import UIActions from 'redux/reducers/ui'
@@ -10,8 +9,6 @@ import { ENTRIES_PER_PAGE_DASHBOARD } from 'redux/constants'
import { IOverall } from 'redux/models/IProject'
const { getProjects, getOverallStats, getLiveVisitors } = require('../../../api')
-const debug = Debug('swetrix:rx:s:load-projects')
-
export default function* loadProjects({ payload: { take = ENTRIES_PER_PAGE_DASHBOARD, skip = 0, search = '' } }) {
const token = getAccessToken()
@@ -39,8 +36,8 @@ export default function* loadProjects({ payload: { take = ENTRIES_PER_PAGE_DASHB
try {
overall = yield call(getOverallStats, pids, '7d')
- } catch (e) {
- debug('failed to overall stats: %s', e)
+ } catch (reason) {
+ console.error('failed to overall stats:', reason)
}
yield put(UIActions.setBirdsEyeBulk(overall))
@@ -63,11 +60,11 @@ export default function* loadProjects({ payload: { take = ENTRIES_PER_PAGE_DASHB
data: liveStats,
}),
)
- } catch (e: unknown) {
- const { message } = e as { message: string }
+ } catch (reason: unknown) {
+ const { message } = reason as { message: string }
if (_isString(message)) {
yield put(UIActions.setProjectsError(message))
}
- debug('failed to load projects: %s', message)
+ console.error('failed to load projects:', message)
}
}
diff --git a/web/app/redux/sagas/ui/load_usageinfo.ts b/web/app/redux/sagas/ui/load_usageinfo.ts
index 4922d49c0..e9bfb8425 100644
--- a/web/app/redux/sagas/ui/load_usageinfo.ts
+++ b/web/app/redux/sagas/ui/load_usageinfo.ts
@@ -1,13 +1,10 @@
import { put, call, select } from 'redux-saga/effects'
-import Debug from 'debug'
import UIActions from 'redux/reducers/ui'
import { isSelfhosted } from 'redux/constants'
import { IUsageInfo } from 'redux/models/IUsageinfo'
const { getUsageInfo } = require('api')
-const debug = Debug('swetrix:rx:s:usageinfo')
-
export default function* loadUsageinfo() {
if (isSelfhosted) {
return
@@ -23,11 +20,11 @@ export default function* loadUsageinfo() {
const info: IUsageInfo = yield call(getUsageInfo)
yield put(UIActions.setUsageinfo(info))
- } catch (e: unknown) {
- const { message } = e as { message: string }
+ } catch (reason: unknown) {
+ const { message } = reason as { message: string }
// if (_isString(message)) {
// yield put(UIActions.setProjectsError(message))
// }
- debug('failed to load usageinfo: %s', message)
+ console.error('failed to load usageinfo:', message)
}
}
diff --git a/web/app/redux/sagas/ui/worker_general_stats.ts b/web/app/redux/sagas/ui/worker_general_stats.ts
index d5b52d8ab..55a0fd4fe 100644
--- a/web/app/redux/sagas/ui/worker_general_stats.ts
+++ b/web/app/redux/sagas/ui/worker_general_stats.ts
@@ -1,13 +1,10 @@
import { put, call, delay } from 'redux-saga/effects'
-import Debug from 'debug'
import UIActions from 'redux/reducers/ui'
import { isSelfhosted } from 'redux/constants'
import { IStats } from 'redux/models/IStats'
const { getGeneralStats } = require('api')
-const debug = Debug('swetrix:rx:s:general-stats')
-
const RETRY_INTERVAL = 10000 // 10 seconds
export default function* generalStats() {
@@ -21,8 +18,8 @@ export default function* generalStats() {
yield put(UIActions.setGeneralStats(stats))
return
- } catch (e) {
- debug('Error while getting general stats data: %s', e)
+ } catch (reason) {
+ console.error('Error while getting general stats data:', reason)
}
yield delay(RETRY_INTERVAL)
diff --git a/web/package-lock.json b/web/package-lock.json
index c10c07719..cabda994f 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -26,7 +26,6 @@
"d3": "^7.9.0",
"dangerously-set-html-content": "^1.1.0",
"dayjs": "^1.11.13",
- "debug": "^4.3.7",
"file-saver": "^2.0.5",
"flatpickr": "^4.6.13",
"framer-motion": "^11.11.11",
diff --git a/web/package.json b/web/package.json
index 8fd309481..e35cc0701 100644
--- a/web/package.json
+++ b/web/package.json
@@ -39,7 +39,6 @@
"d3": "^7.9.0",
"dangerously-set-html-content": "^1.1.0",
"dayjs": "^1.11.13",
- "debug": "^4.3.7",
"file-saver": "^2.0.5",
"flatpickr": "^4.6.13",
"framer-motion": "^11.11.11",