Merge pull request #2446 from bluewave-labs/fix/remove-team-and-user-id

fix: remove team and user
This commit is contained in:
Alexander Holliday
2025-06-13 13:35:36 +08:00
committed by GitHub
17 changed files with 31 additions and 46 deletions
+2 -2
View File
@@ -414,10 +414,10 @@ const useDeleteAllMonitors = () => {
const UseDeleteMonitorStats = () => {
const { t } = useTranslation();
const [isLoading, setIsLoading] = useState(false);
const deleteMonitorStats = async ({ teamId }) => {
const deleteMonitorStats = async () => {
setIsLoading(true);
try {
const res = await networkService.deleteChecksByTeamId({ teamId });
await networkService.deleteChecksByTeamId();
createToast({ body: t("settingsStatsCleared") });
} catch (error) {
createToast({ body: t("settingsFailedToClearStats") });
-1
View File
@@ -2,7 +2,6 @@ import { useState, useEffect, useCallback } from "react";
import { createToast } from "../Utils/toastUtils";
import { networkService } from "../main";
import { useNavigate } from "react-router-dom";
import { useSelector } from "react-redux";
import { useTranslation } from "react-i18next";
import { NOTIFICATION_TYPES } from "../Pages/Notifications/utils";
+1 -1
View File
@@ -29,7 +29,7 @@ const Incidents = () => {
//Utils
const theme = useTheme();
const [monitors, , isLoading, networkError] = useFetchMonitorsByTeamId();
const [monitors, , isLoading, networkError] = useFetchMonitorsByTeamId({});
useEffect(() => {
const monitorLookup = monitors?.reduce((acc, monitor) => {
@@ -186,8 +186,6 @@ const CreateInfrastructureMonitor = () => {
...(isCreate ? {} : { _id: monitorId }),
...rest,
description: form.name,
teamId: user.teamId,
userId: user._id,
type: "hardware",
notifications: infrastructureMonitor.notifications,
thresholds,
@@ -48,8 +48,6 @@ const CreateNotifications = () => {
// local state
const [notification, setNotification] = useState({
userId: user._id,
teamId: user.teamId,
notificationName: "",
address: "",
type: NOTIFICATION_TYPES[0]._id,
@@ -86,8 +86,6 @@ const CreatePageSpeed = () => {
form = {
...form,
description: form.name,
teamId: user.teamId,
userId: user._id,
notifications: monitor.notifications,
};
+1 -1
View File
@@ -96,7 +96,7 @@ const Settings = () => {
}
if (name === "deleteStats") {
await deleteMonitorStats({ teamId: user.teamId });
await deleteMonitorStats();
return;
}
@@ -1,17 +1,14 @@
import { useState } from "react";
import { networkService } from "../../../../main";
import { useSelector } from "react-redux";
import { createToast } from "../../../../Utils/toastUtils";
const useCreateStatusPage = (isCreate, url) => {
const { user } = useSelector((state) => state.auth);
const [isLoading, setIsLoading] = useState(false);
const [networkError, setNetworkError] = useState(false);
const createStatusPage = async ({ form }) => {
setIsLoading(true);
try {
await networkService.createStatusPage({ user, form, isCreate, url });
await networkService.createStatusPage({ form, isCreate, url });
return true;
} catch (error) {
setNetworkError(true);
@@ -13,9 +13,7 @@ const useStatusPagesFetch = () => {
useEffect(() => {
const fetchStatusPages = async () => {
try {
const res = await networkService.getStatusPagesByTeamId({
teamId: user.teamId,
});
const res = await networkService.getStatusPagesByTeamId();
setStatusPages(res?.data?.data);
} catch (error) {
setNetworkError(true);
-6
View File
@@ -18,7 +18,6 @@ import Checkbox from "../../../Components/Inputs/Checkbox";
// Utils
import { useTheme } from "@emotion/react";
import { useState } from "react";
import { useSelector } from "react-redux";
import { useTranslation } from "react-i18next";
import { monitorValidation } from "../../../Validation/validation";
import { createToast } from "../../../Utils/toastUtils";
@@ -26,9 +25,6 @@ import { useGetNotificationsByTeamId } from "../../../Hooks/useNotifications";
import { useCreateMonitor } from "../../../Hooks/monitorHooks";
const CreateMonitor = () => {
// Redux state
const { user } = useSelector((state) => state.auth);
// Local state
const [errors, setErrors] = useState({});
const [https, setHttps] = useState(true);
@@ -143,8 +139,6 @@ const CreateMonitor = () => {
form = {
...form,
description: monitor.name || monitor.url,
teamId: user.teamId,
userId: user._id,
notifications: monitor.notifications,
};
+2 -5
View File
@@ -838,8 +838,7 @@ class NetworkService {
}
async getStatusPagesByTeamId(config) {
const { teamId } = config;
return this.axiosInstance.get(`/status-page/team/${teamId}`, {
return this.axiosInstance.get(`/status-page/team`, {
headers: {
"Content-Type": "application/json",
},
@@ -847,11 +846,9 @@ class NetworkService {
}
async createStatusPage(config) {
const { user, form, isCreate } = config;
const { form, isCreate } = config;
const fd = new FormData();
fd.append("teamId", user.teamId);
fd.append("userId", user._id);
fd.append("type", form.type);
form.isPublished !== undefined && fd.append("isPublished", form.isPublished);
form.companyName && fd.append("companyName", form.companyName);