diff --git a/client/src/components/inputs/SwitchTeam.tsx b/client/src/components/inputs/SwitchTeam.tsx index fbbfbdced..ef262a387 100644 --- a/client/src/components/inputs/SwitchTeam.tsx +++ b/client/src/components/inputs/SwitchTeam.tsx @@ -10,7 +10,7 @@ import { useState, useEffect } from "react"; import { useAppSelector, useAppDispatch } from "@/hooks/AppHooks"; import { setSelectedTeamId } from "@/features/authSlice"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useTheme } from "@mui/material/styles"; import { useTranslation } from "react-i18next"; diff --git a/client/src/hooks/UseApi.tsx b/client/src/hooks/UseApi.tsx index 056859f37..97c8b5b70 100644 --- a/client/src/hooks/UseApi.tsx +++ b/client/src/hooks/UseApi.tsx @@ -5,11 +5,7 @@ import type { AxiosRequestConfig } from "axios"; import { get, post, patch, deleteOp } from "@/utils/ApiClient"; import { useAppSelector } from "@/hooks/AppHooks"; import { useToast } from "@/hooks//UseToast"; - -export type ApiResponse = { - message: string; - data: T; -}; +import type { ApiResponse } from "@/types/api"; export interface IExtraConfig { useTeamIdAsKey?: boolean; diff --git a/client/src/pages/auth/Invite.tsx b/client/src/pages/auth/Invite.tsx index f7038e9e9..58f1cee20 100644 --- a/client/src/pages/auth/Invite.tsx +++ b/client/src/pages/auth/Invite.tsx @@ -13,7 +13,7 @@ import { z } from "zod"; import { useForm, Controller } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { useGet, usePost } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { config } from "@/config/index"; const HOST = config.HOST; diff --git a/client/src/pages/auth/RegisterInvite.tsx b/client/src/pages/auth/RegisterInvite.tsx index b1f95b815..48e9ed9ec 100644 --- a/client/src/pages/auth/RegisterInvite.tsx +++ b/client/src/pages/auth/RegisterInvite.tsx @@ -8,7 +8,7 @@ import { setSelectedTeamId, } from "@/features/authSlice"; import { useAppDispatch } from "@/hooks/AppHooks"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useTranslation } from "react-i18next"; import { usePost } from "@/hooks/UseApi"; import { useNavigate } from "react-router"; diff --git a/client/src/pages/billing/Billing.tsx b/client/src/pages/billing/Billing.tsx index c333567c9..abdc99e66 100644 --- a/client/src/pages/billing/Billing.tsx +++ b/client/src/pages/billing/Billing.tsx @@ -6,7 +6,7 @@ import { Button } from "@/components/inputs"; import { useTranslation } from "react-i18next"; import { useAppDispatch, useAppSelector } from "@/hooks/AppHooks"; import { useGet, usePost } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { Entitlements, PlanKey } from "@/types/entitlements"; import { useEffect } from "react"; import type { IUser } from "@/types/user"; diff --git a/client/src/pages/billing/Success.tsx b/client/src/pages/billing/Success.tsx index 249b9cd7e..0d8779bbb 100644 --- a/client/src/pages/billing/Success.tsx +++ b/client/src/pages/billing/Success.tsx @@ -7,7 +7,7 @@ import { Button } from "@/components/inputs"; import { useTheme } from "@mui/material/styles"; import { Navigate, useSearchParams } from "react-router-dom"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useEffect, useMemo, useState } from "react"; const BillingSuccessPage = () => { diff --git a/client/src/pages/checks/ChecksPage.tsx b/client/src/pages/checks/ChecksPage.tsx index 8bd359844..3650809bc 100644 --- a/client/src/pages/checks/ChecksPage.tsx +++ b/client/src/pages/checks/ChecksPage.tsx @@ -10,7 +10,7 @@ import { useTheme } from "@mui/material/styles"; import { useState } from "react"; import type { SelectChangeEvent } from "@mui/material/Select"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { IMonitor } from "@/types/monitor"; import type { ICheck } from "@/types/check"; import { config } from "@/config/index"; diff --git a/client/src/pages/diagnostic/DiagnosticsLogTab.tsx b/client/src/pages/diagnostic/DiagnosticsLogTab.tsx index 0122b8128..b7a7f1704 100644 --- a/client/src/pages/diagnostic/DiagnosticsLogTab.tsx +++ b/client/src/pages/diagnostic/DiagnosticsLogTab.tsx @@ -10,7 +10,7 @@ import { useState } from "react"; import { useGet } from "@/hooks/UseApi"; import { useTheme } from "@mui/material/styles"; import type { ILogEntry } from "@/types/log"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; export const DiagnosticsLogTab = () => { const theme = useTheme(); diff --git a/client/src/pages/diagnostic/DiagnosticsQueueTab.tsx b/client/src/pages/diagnostic/DiagnosticsQueueTab.tsx index bd10a5247..8fb70594f 100644 --- a/client/src/pages/diagnostic/DiagnosticsQueueTab.tsx +++ b/client/src/pages/diagnostic/DiagnosticsQueueTab.tsx @@ -5,7 +5,7 @@ import { Table } from "@/components/design-elements"; import { useTheme } from "@mui/material/styles"; import { useTranslation } from "react-i18next"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { IJob, IJobMetrics } from "@/types/job"; import type { Header } from "@/components/design-elements/Table"; diff --git a/client/src/pages/incidents/IncidentDetails.tsx b/client/src/pages/incidents/IncidentDetails.tsx index 6c3d00549..cea3b47fc 100644 --- a/client/src/pages/incidents/IncidentDetails.tsx +++ b/client/src/pages/incidents/IncidentDetails.tsx @@ -6,7 +6,7 @@ import Typography from "@mui/material/Typography"; import { useTheme } from "@mui/material/styles"; import { useNavigate, useParams } from "react-router"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { IIncident } from "@/types/incident"; import { formatDateWithTz } from "@/utils/TimeUtils"; import { useAppSelector } from "@/hooks/AppHooks"; diff --git a/client/src/pages/incidents/IncidentsPage.tsx b/client/src/pages/incidents/IncidentsPage.tsx index 6d42e94f7..273aeab7d 100644 --- a/client/src/pages/incidents/IncidentsPage.tsx +++ b/client/src/pages/incidents/IncidentsPage.tsx @@ -10,7 +10,7 @@ import { useTheme } from "@mui/material/styles"; import { useSearchParams } from "react-router"; import { useState, useEffect } from "react"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { SelectChangeEvent } from "@mui/material/Select"; import type { IIncident } from "@/types/incident"; import type { IMonitor } from "@/types/monitor"; diff --git a/client/src/pages/infrastructure/InfraConfig.tsx b/client/src/pages/infrastructure/InfraConfig.tsx index 0cd3a4e20..7dede1076 100644 --- a/client/src/pages/infrastructure/InfraConfig.tsx +++ b/client/src/pages/infrastructure/InfraConfig.tsx @@ -3,7 +3,7 @@ import { useGet, usePatch } from "@/hooks/UseApi"; import { InfraForm } from "@/pages/infrastructure/InfraForm"; import { useParams } from "react-router"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import humanInterval from "human-interval"; import { z } from "zod"; import { useNavigate } from "react-router"; diff --git a/client/src/pages/infrastructure/InfraCreate.tsx b/client/src/pages/infrastructure/InfraCreate.tsx index 633f13752..21b571183 100644 --- a/client/src/pages/infrastructure/InfraCreate.tsx +++ b/client/src/pages/infrastructure/InfraCreate.tsx @@ -4,7 +4,7 @@ import { useNavigate } from "react-router"; import { z } from "zod"; import { monitorSchemaInfra } from "@/validation/zod"; import { useGet, usePost } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { INotificationChannel } from "@/types/notification-channel"; const InfraCreatePage = () => { type FormValues = z.infer; diff --git a/client/src/pages/infrastructure/InfraDetails.tsx b/client/src/pages/infrastructure/InfraDetails.tsx index 2bd82b0d2..2db54eee5 100644 --- a/client/src/pages/infrastructure/InfraDetails.tsx +++ b/client/src/pages/infrastructure/InfraDetails.tsx @@ -10,7 +10,7 @@ import { useGet, usePatch } from "@/hooks/UseApi"; import { useState } from "react"; import { useTheme } from "@mui/material/styles"; import { useParams } from "react-router"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { IMonitor, IMonitorWithMonitorStats } from "@/types/monitor"; import type { IInfraCheck } from "@/types/check"; import { diff --git a/client/src/pages/infrastructure/InfraMonitors.tsx b/client/src/pages/infrastructure/InfraMonitors.tsx index 5df2f6f44..80bfb1472 100644 --- a/client/src/pages/infrastructure/InfraMonitors.tsx +++ b/client/src/pages/infrastructure/InfraMonitors.tsx @@ -13,7 +13,7 @@ import { InfraMonitorsTable } from "./InfraMonitorsTable"; import { useTranslation } from "react-i18next"; import { useTheme } from "@mui/material/styles"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { IMonitor, IMonitorWithStats } from "@/types/monitor"; import useMediaQuery from "@mui/material/useMediaQuery"; import { useState } from "react"; diff --git a/client/src/pages/maintenance/Maintenance.tsx b/client/src/pages/maintenance/Maintenance.tsx index 532eebfe4..163c75fd1 100644 --- a/client/src/pages/maintenance/Maintenance.tsx +++ b/client/src/pages/maintenance/Maintenance.tsx @@ -11,7 +11,7 @@ import { usePatch, useGet, useDelete } from "@/hooks/UseApi"; import { useNavigate } from "react-router"; import type { Header } from "@/components/design-elements/Table"; import { useTranslation } from "react-i18next"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { IMaintenance } from "@/types/maintenance"; import type { ActionMenuItem } from "@/components/actions-menu"; import { config } from "@/config/index"; diff --git a/client/src/pages/maintenance/MaintenanceConfig.tsx b/client/src/pages/maintenance/MaintenanceConfig.tsx index 16dd407a6..a35f4a9fa 100644 --- a/client/src/pages/maintenance/MaintenanceConfig.tsx +++ b/client/src/pages/maintenance/MaintenanceConfig.tsx @@ -4,7 +4,7 @@ import { useParams } from "react-router"; import { useNavigate } from "react-router"; import { z } from "zod"; import { usePatch, useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { maintenanceSchema } from "@/validation/zod"; import type { IMonitor } from "@/types/monitor"; diff --git a/client/src/pages/maintenance/MaintenanceCreate.tsx b/client/src/pages/maintenance/MaintenanceCreate.tsx index 4e188505e..dee0c734d 100644 --- a/client/src/pages/maintenance/MaintenanceCreate.tsx +++ b/client/src/pages/maintenance/MaintenanceCreate.tsx @@ -3,7 +3,7 @@ import { MaintenanceForm } from "@/pages/maintenance/MaintenanceForm"; import { useNavigate } from "react-router"; import { z } from "zod"; import { usePost, useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { maintenanceSchema } from "@/validation/zod"; import type { IMonitor } from "@/types/monitor"; import type { IMaintenance } from "@/types/maintenance"; diff --git a/client/src/pages/notification-channels/NotificationChannels.tsx b/client/src/pages/notification-channels/NotificationChannels.tsx index 15ac4d5a6..1ac887fcb 100644 --- a/client/src/pages/notification-channels/NotificationChannels.tsx +++ b/client/src/pages/notification-channels/NotificationChannels.tsx @@ -12,7 +12,7 @@ import type { ActionMenuItem } from "@/components/actions-menu"; import type { Header } from "@/components/design-elements/Table"; import type { INotificationChannel } from "@/types/notification-channel"; import { useGet, usePatch, useDelete } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useTranslation } from "react-i18next"; import { config } from "@/config/index"; diff --git a/client/src/pages/notification-channels/NotificationChannelsConfig.tsx b/client/src/pages/notification-channels/NotificationChannelsConfig.tsx index 89b436a2d..5b71fd47a 100644 --- a/client/src/pages/notification-channels/NotificationChannelsConfig.tsx +++ b/client/src/pages/notification-channels/NotificationChannelsConfig.tsx @@ -4,7 +4,7 @@ import { useParams } from "react-router"; import { useNavigate } from "react-router"; import { z } from "zod"; import { usePatch, useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { notificationChannelSchema } from "@/validation/zod"; import type { INotificationChannel } from "@/types/notification-channel"; diff --git a/client/src/pages/pagespeed/PageSpeedConfig.tsx b/client/src/pages/pagespeed/PageSpeedConfig.tsx index 7368e0e13..5a291406b 100644 --- a/client/src/pages/pagespeed/PageSpeedConfig.tsx +++ b/client/src/pages/pagespeed/PageSpeedConfig.tsx @@ -3,7 +3,7 @@ import { useGet, usePatch } from "@/hooks/UseApi"; import { PageSpeedForm } from "@/pages/pagespeed/PageSpeedForm"; import { useParams } from "react-router"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import humanInterval from "human-interval"; import { z } from "zod"; import { useNavigate } from "react-router"; diff --git a/client/src/pages/pagespeed/PageSpeedCreate.tsx b/client/src/pages/pagespeed/PageSpeedCreate.tsx index 5bd6dee7c..e5c395565 100644 --- a/client/src/pages/pagespeed/PageSpeedCreate.tsx +++ b/client/src/pages/pagespeed/PageSpeedCreate.tsx @@ -4,7 +4,7 @@ import humanInterval from "human-interval"; import { z } from "zod"; import { monitorSchema } from "@/validation/zod"; import { useGet, usePost } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useNavigate } from "react-router"; import type { INotificationChannel } from "@/types/notification-channel"; const UptimeCreatePage = () => { diff --git a/client/src/pages/pagespeed/PageSpeedDetails.tsx b/client/src/pages/pagespeed/PageSpeedDetails.tsx index 947efaa83..ca2bb1409 100644 --- a/client/src/pages/pagespeed/PageSpeedDetails.tsx +++ b/client/src/pages/pagespeed/PageSpeedDetails.tsx @@ -10,7 +10,7 @@ import { useState } from "react"; import { useParams } from "react-router"; import { useTheme } from "@mui/material/styles"; import { useGet, usePatch } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { IMonitor, IMonitorWithMonitorStats } from "@/types/monitor"; import { getStatusPalette } from "@/utils/MonitorUtils"; import prettyMilliseconds from "pretty-ms"; diff --git a/client/src/pages/pagespeed/PageSpeedMonitors.tsx b/client/src/pages/pagespeed/PageSpeedMonitors.tsx index de599d753..22694cb2f 100644 --- a/client/src/pages/pagespeed/PageSpeedMonitors.tsx +++ b/client/src/pages/pagespeed/PageSpeedMonitors.tsx @@ -13,7 +13,7 @@ import { PageSpeedMonitorTable } from "./PageSpeedMonitorTable"; import { useTranslation } from "react-i18next"; import { useTheme } from "@mui/material/styles"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { IMonitor, IMonitorWithStats } from "@/types/monitor"; import useMediaQuery from "@mui/material/useMediaQuery"; import { useState } from "react"; diff --git a/client/src/pages/profile/Profile.tsx b/client/src/pages/profile/Profile.tsx index b99e8f772..331ed5bc4 100644 --- a/client/src/pages/profile/Profile.tsx +++ b/client/src/pages/profile/Profile.tsx @@ -3,7 +3,7 @@ import { ProfileForm } from "@/pages/profile/ProfileForm"; import { useState, useEffect } from "react"; import type { IUser } from "@/types/user"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useGet, usePatch, useGetOnDemand } from "@/hooks/UseApi"; import { z } from "zod"; import { profileSchema } from "@/validation/zod"; diff --git a/client/src/pages/settings/AdminSettings.tsx b/client/src/pages/settings/AdminSettings.tsx index a201c5437..c2d130d15 100644 --- a/client/src/pages/settings/AdminSettings.tsx +++ b/client/src/pages/settings/AdminSettings.tsx @@ -6,7 +6,7 @@ import { useMemo } from "react"; import {} from "react-i18next"; import { useAppSelector } from "@/hooks/AppHooks"; import { useGet, usePatch, usePost } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { z } from "zod"; import { systemSettingsSchema } from "@/validation/zod"; diff --git a/client/src/pages/status-page/StatusPageConfig.tsx b/client/src/pages/status-page/StatusPageConfig.tsx index 172ebd6f9..8b7b3af59 100644 --- a/client/src/pages/status-page/StatusPageConfig.tsx +++ b/client/src/pages/status-page/StatusPageConfig.tsx @@ -4,7 +4,7 @@ import { useParams } from "react-router"; import { useNavigate } from "react-router"; import { z } from "zod"; import { usePatch, useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { statusPageSchema } from "@/validation/zod"; import type { IMonitor } from "@/types/monitor"; import type { IStatusPageWithMonitors } from "@/types/status-page"; diff --git a/client/src/pages/status-page/StatusPageCreate.tsx b/client/src/pages/status-page/StatusPageCreate.tsx index 28bb9902f..8ebbeeae3 100644 --- a/client/src/pages/status-page/StatusPageCreate.tsx +++ b/client/src/pages/status-page/StatusPageCreate.tsx @@ -3,7 +3,7 @@ import { StatusPageForm } from "@/pages/status-page/StatusPageForm"; import { useNavigate } from "react-router"; import { z } from "zod"; import { usePost, useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { statusPageSchema } from "@/validation/zod"; import type { IMonitor } from "@/types/monitor"; diff --git a/client/src/pages/status-page/StatusPageDetails.tsx b/client/src/pages/status-page/StatusPageDetails.tsx index 1459b043e..335fb646f 100644 --- a/client/src/pages/status-page/StatusPageDetails.tsx +++ b/client/src/pages/status-page/StatusPageDetails.tsx @@ -6,7 +6,7 @@ import { BasePage } from "@/components/design-elements"; import { useTheme } from "@mui/material/styles"; import type { IMonitor } from "@/types/monitor"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useParams } from "react-router"; import type { IStatusPageWithMonitors } from "@/types/status-page"; import { NameHeader } from "@/components/status-pages/NameHeader"; diff --git a/client/src/pages/status-page/StatusPagePublic.tsx b/client/src/pages/status-page/StatusPagePublic.tsx index 097846d32..9162fb6b6 100644 --- a/client/src/pages/status-page/StatusPagePublic.tsx +++ b/client/src/pages/status-page/StatusPagePublic.tsx @@ -6,7 +6,7 @@ import { BasePage } from "@/components/design-elements"; import { useTheme } from "@mui/material/styles"; import type { IMonitor } from "@/types/monitor"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useParams } from "react-router"; import type { IStatusPageWithMonitors } from "@/types/status-page"; import { NameHeader } from "@/components/status-pages/NameHeader"; diff --git a/client/src/pages/status-page/StatusPages.tsx b/client/src/pages/status-page/StatusPages.tsx index 946b73370..0e17b56cb 100644 --- a/client/src/pages/status-page/StatusPages.tsx +++ b/client/src/pages/status-page/StatusPages.tsx @@ -6,7 +6,7 @@ import { StatusPageTable } from "@/pages/status-page/StatusPageTable"; import { useState } from "react"; import type { IStatusPage } from "@/types/status-page"; import { useGet, useDelete } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useTranslation } from "react-i18next"; import { config } from "@/config/index"; diff --git a/client/src/pages/teams/TeamDetails.tsx b/client/src/pages/teams/TeamDetails.tsx index e96d48bab..3dd28780f 100644 --- a/client/src/pages/teams/TeamDetails.tsx +++ b/client/src/pages/teams/TeamDetails.tsx @@ -10,7 +10,7 @@ import { useNavigate } from "react-router"; import { useTheme } from "@mui/material/styles"; import { useParams } from "react-router"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { ITeamMember } from "@/types/team-member"; const TeamDetailsPage = () => { diff --git a/client/src/pages/teams/TeamMemberConfig.tsx b/client/src/pages/teams/TeamMemberConfig.tsx index a4631ef70..131e79c77 100644 --- a/client/src/pages/teams/TeamMemberConfig.tsx +++ b/client/src/pages/teams/TeamMemberConfig.tsx @@ -5,7 +5,7 @@ import { Dialog } from "@/components/inputs"; import { useState } from "react"; import { useGet, usePatch, useGetOnDemand } from "@/hooks/UseApi"; import { useParams } from "react-router"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useNavigate } from "react-router"; import { useDelete } from "@/hooks/UseApi"; import { useTranslation } from "react-i18next"; diff --git a/client/src/pages/teams/TeamMemberCreate.tsx b/client/src/pages/teams/TeamMemberCreate.tsx index 3a4da062b..873c9913c 100644 --- a/client/src/pages/teams/TeamMemberCreate.tsx +++ b/client/src/pages/teams/TeamMemberCreate.tsx @@ -2,7 +2,7 @@ import { TeamMemberForm } from "./TeamMemberForm"; import { useParams } from "react-router"; import { useGet, usePost } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useNavigate } from "react-router"; import { mutate } from "swr"; import { useGetOnDemand } from "@/hooks/UseApi"; diff --git a/client/src/pages/teams/Teams.tsx b/client/src/pages/teams/Teams.tsx index 1edbe6449..db0ed0438 100644 --- a/client/src/pages/teams/Teams.tsx +++ b/client/src/pages/teams/Teams.tsx @@ -9,7 +9,7 @@ import { useNavigate } from "react-router"; import { useTranslation } from "react-i18next"; import type { ActionMenuItem } from "@/components/actions-menu"; import type { Header } from "@/components/design-elements/Table"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useGet, useDelete } from "@/hooks/UseApi"; import type { ITeam } from "@/types/team"; import { useState } from "react"; diff --git a/client/src/pages/teams/TeamsConfig.tsx b/client/src/pages/teams/TeamsConfig.tsx index d45fe274a..caf1bfa11 100644 --- a/client/src/pages/teams/TeamsConfig.tsx +++ b/client/src/pages/teams/TeamsConfig.tsx @@ -4,7 +4,7 @@ import { useNavigate, useParams } from "react-router"; import { z } from "zod"; import { teamSchema } from "@/validation/zod"; import { useGet, usePatch, useGetOnDemand } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { IUser } from "@/types/user"; import { useAppDispatch } from "@/hooks/AppHooks"; import { setUser } from "@/features/authSlice"; diff --git a/client/src/pages/teams/TeamsCreate.tsx b/client/src/pages/teams/TeamsCreate.tsx index 606eb84b1..29a4e7597 100644 --- a/client/src/pages/teams/TeamsCreate.tsx +++ b/client/src/pages/teams/TeamsCreate.tsx @@ -4,7 +4,7 @@ import { useNavigate } from "react-router"; import { z } from "zod"; import { teamSchema } from "@/validation/zod"; import { useGet, usePost, useGetOnDemand } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { mutate } from "swr"; import type { IUser } from "@/types/user"; import { useAppDispatch } from "@/hooks/AppHooks"; diff --git a/client/src/pages/uptime/CheckTable.tsx b/client/src/pages/uptime/CheckTable.tsx index 39440fa4b..29a8b9d86 100644 --- a/client/src/pages/uptime/CheckTable.tsx +++ b/client/src/pages/uptime/CheckTable.tsx @@ -3,7 +3,7 @@ import Box from "@mui/material/Box"; import type { Header } from "@/components/design-elements/Table"; import type { ICheck, IChecksWithCount } from "@/types/check"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import type { MonitorStatus } from "@/types/monitor"; import { useState } from "react"; diff --git a/client/src/pages/uptime/UptimeConfigure.tsx b/client/src/pages/uptime/UptimeConfigure.tsx index 8a91bf5a2..95d04fbf5 100644 --- a/client/src/pages/uptime/UptimeConfigure.tsx +++ b/client/src/pages/uptime/UptimeConfigure.tsx @@ -3,7 +3,7 @@ import { useGet, usePatch } from "@/hooks/UseApi"; import { UptimeForm } from "@/pages/uptime/UptimeForm"; import { useParams } from "react-router"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import humanInterval from "human-interval"; import { z } from "zod"; import { useNavigate } from "react-router"; diff --git a/client/src/pages/uptime/UptimeCreate.tsx b/client/src/pages/uptime/UptimeCreate.tsx index eb3941e15..4a7535cae 100644 --- a/client/src/pages/uptime/UptimeCreate.tsx +++ b/client/src/pages/uptime/UptimeCreate.tsx @@ -4,7 +4,7 @@ import humanInterval from "human-interval"; import { z } from "zod"; import { monitorSchema } from "@/validation/zod"; import { useGet, usePost } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useNavigate } from "react-router"; import type { INotificationChannel } from "@/types/notification-channel"; const UptimeCreatePage = () => { diff --git a/client/src/pages/uptime/UptimeDetails.tsx b/client/src/pages/uptime/UptimeDetails.tsx index d42a87a20..193aa301b 100644 --- a/client/src/pages/uptime/UptimeDetails.tsx +++ b/client/src/pages/uptime/UptimeDetails.tsx @@ -14,7 +14,8 @@ import type { IMonitor, IMonitorWithMonitorStats } from "@/types/monitor"; import useMediaQuery from "@mui/material/useMediaQuery"; import { useTheme } from "@mui/material/styles"; import { useParams } from "react-router"; -import { useGet, usePatch, type ApiResponse } from "@/hooks/UseApi"; +import { useGet, usePatch } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { useState } from "react"; import { getStatusPalette } from "@/utils/MonitorUtils"; import prettyMilliseconds from "pretty-ms"; diff --git a/client/src/pages/uptime/UptimeMonitors.tsx b/client/src/pages/uptime/UptimeMonitors.tsx index fa344061a..692e1c67f 100644 --- a/client/src/pages/uptime/UptimeMonitors.tsx +++ b/client/src/pages/uptime/UptimeMonitors.tsx @@ -15,7 +15,7 @@ import { InitializingStatusBox } from "@/components/design-elements/StatusBox"; import { useTranslation } from "react-i18next"; import { useTheme } from "@mui/material/styles"; import { useGet } from "@/hooks/UseApi"; -import type { ApiResponse } from "@/hooks/UseApi"; +import type { ApiResponse } from "@/types/api"; import { type IMonitor, type IMonitorWithStats, diff --git a/client/src/types/api.ts b/client/src/types/api.ts new file mode 100644 index 000000000..b12046018 --- /dev/null +++ b/client/src/types/api.ts @@ -0,0 +1,5 @@ +export type ApiResponse = { + message: string; + data: T; +}; +