remove teamId from status pages

This commit is contained in:
Alex Holliday committed 2025-06-13 13:29:03 +08:00
1 parent 18ea551118
commit b499b2879c
6 files changed
+5 -14

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ const Incidents = () => {
//Utils //Utils
const theme = useTheme(); const theme = useTheme();
const [monitors, , isLoading, networkError] = useFetchMonitorsByTeamId(); const [monitors, , isLoading, networkError] = useFetchMonitorsByTeamId({});
useEffect(() => { useEffect(() => {
const monitorLookup = monitors?.reduce((acc, monitor) => { const monitorLookup = monitors?.reduce((acc, monitor) => {
@@ -13,9 +13,7 @@ const useStatusPagesFetch = () => {
useEffect(() => { useEffect(() => {
const fetchStatusPages = async () => { const fetchStatusPages = async () => {
try { try {
const res = await networkService.getStatusPagesByTeamId({ const res = await networkService.getStatusPagesByTeamId();
teamId: user.teamId,
});
setStatusPages(res?.data?.data); setStatusPages(res?.data?.data);
} catch (error) { } catch (error) {
setNetworkError(true); setNetworkError(true);
+1 -2
View File
@@ -838,8 +838,7 @@ class NetworkService {
} }
async getStatusPagesByTeamId(config) { async getStatusPagesByTeamId(config) {
const { teamId } = config; return this.axiosInstance.get(`/status-page/team`, {
return this.axiosInstance.get(`/status-page/team/${teamId}`, {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
+1 -1
View File
@@ -99,7 +99,7 @@ class StatusPageController {
getStatusPagesByTeamId = async (req, res, next) => { getStatusPagesByTeamId = async (req, res, next) => {
try { try {
const teamId = req.params.teamId; const teamId = req.user.teamId;
const statusPages = await this.db.getStatusPagesByTeamId(teamId); const statusPages = await this.db.getStatusPagesByTeamId(teamId);
return res.success({ return res.success({
+1 -5
View File
@@ -12,11 +12,7 @@ class StatusPageRoutes {
initRoutes() { initRoutes() {
this.router.get("/", this.statusPageController.getStatusPage); this.router.get("/", this.statusPageController.getStatusPage);
this.router.get( this.router.get("/team", verifyJWT, this.statusPageController.getStatusPagesByTeamId);
"/team/:teamId",
verifyJWT,
this.statusPageController.getStatusPagesByTeamId
);
this.router.get("/:url", this.statusPageController.getStatusPageByUrl); this.router.get("/:url", this.statusPageController.getStatusPageByUrl);
this.router.post( this.router.post(
-2
View File
@@ -165,8 +165,6 @@ const getCertificateParamValidation = joi.object({
const createMonitorBodyValidation = joi.object({ const createMonitorBodyValidation = joi.object({
_id: joi.string(), _id: joi.string(),
userId: joi.string().required(),
teamId: joi.string().required(),
name: joi.string().required(), name: joi.string().required(),
description: joi.string().required(), description: joi.string().required(),
type: joi.string().required(), type: joi.string().required(),