move ApiResponse
This commit is contained in:
1 parent
03b6d5976c
commit
0b626f991f
43 files changed
+48
-46
No files matched your search
@@ -10,7 +10,7 @@ import { useState, useEffect } from "react";
|
|||||||
import { useAppSelector, useAppDispatch } from "@/hooks/AppHooks";
|
import { useAppSelector, useAppDispatch } from "@/hooks/AppHooks";
|
||||||
import { setSelectedTeamId } from "@/features/authSlice";
|
import { setSelectedTeamId } from "@/features/authSlice";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
import { useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,7 @@ import type { AxiosRequestConfig } from "axios";
|
|||||||
import { get, post, patch, deleteOp } from "@/utils/ApiClient";
|
import { get, post, patch, deleteOp } from "@/utils/ApiClient";
|
||||||
import { useAppSelector } from "@/hooks/AppHooks";
|
import { useAppSelector } from "@/hooks/AppHooks";
|
||||||
import { useToast } from "@/hooks//UseToast";
|
import { useToast } from "@/hooks//UseToast";
|
||||||
|
import type { ApiResponse } from "@/types/api";
|
||||||
export type ApiResponse<T> = {
|
|
||||||
message: string;
|
|
||||||
data: T;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface IExtraConfig {
|
export interface IExtraConfig {
|
||||||
useTeamIdAsKey?: boolean;
|
useTeamIdAsKey?: boolean;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { z } from "zod";
|
|||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { useGet, usePost } from "@/hooks/UseApi";
|
import { useGet, usePost } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { config } from "@/config/index";
|
import { config } from "@/config/index";
|
||||||
const HOST = config.HOST;
|
const HOST = config.HOST;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
setSelectedTeamId,
|
setSelectedTeamId,
|
||||||
} from "@/features/authSlice";
|
} from "@/features/authSlice";
|
||||||
import { useAppDispatch } from "@/hooks/AppHooks";
|
import { useAppDispatch } from "@/hooks/AppHooks";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { usePost } from "@/hooks/UseApi";
|
import { usePost } from "@/hooks/UseApi";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Button } from "@/components/inputs";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useAppDispatch, useAppSelector } from "@/hooks/AppHooks";
|
import { useAppDispatch, useAppSelector } from "@/hooks/AppHooks";
|
||||||
import { useGet, usePost } from "@/hooks/UseApi";
|
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 type { Entitlements, PlanKey } from "@/types/entitlements";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import type { IUser } from "@/types/user";
|
import type { IUser } from "@/types/user";
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Button } from "@/components/inputs";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { Navigate, useSearchParams } from "react-router-dom";
|
import { Navigate, useSearchParams } from "react-router-dom";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
import { useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
|
|
||||||
const BillingSuccessPage = () => {
|
const BillingSuccessPage = () => {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useTheme } from "@mui/material/styles";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import type { SelectChangeEvent } from "@mui/material/Select";
|
import type { SelectChangeEvent } from "@mui/material/Select";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
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 { IMonitor } from "@/types/monitor";
|
||||||
import type { ICheck } from "@/types/check";
|
import type { ICheck } from "@/types/check";
|
||||||
import { config } from "@/config/index";
|
import { config } from "@/config/index";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useState } from "react";
|
|||||||
import { useGet } from "@/hooks/UseApi";
|
import { useGet } from "@/hooks/UseApi";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import type { ILogEntry } from "@/types/log";
|
import type { ILogEntry } from "@/types/log";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
|
|
||||||
export const DiagnosticsLogTab = () => {
|
export const DiagnosticsLogTab = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Table } from "@/components/design-elements";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
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 { IJob, IJobMetrics } from "@/types/job";
|
||||||
import type { Header } from "@/components/design-elements/Table";
|
import type { Header } from "@/components/design-elements/Table";
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Typography from "@mui/material/Typography";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useNavigate, useParams } from "react-router";
|
import { useNavigate, useParams } from "react-router";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
import { useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import type { IIncident } from "@/types/incident";
|
import type { IIncident } from "@/types/incident";
|
||||||
import { formatDateWithTz } from "@/utils/TimeUtils";
|
import { formatDateWithTz } from "@/utils/TimeUtils";
|
||||||
import { useAppSelector } from "@/hooks/AppHooks";
|
import { useAppSelector } from "@/hooks/AppHooks";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useTheme } from "@mui/material/styles";
|
|||||||
import { useSearchParams } from "react-router";
|
import { useSearchParams } from "react-router";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
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 { SelectChangeEvent } from "@mui/material/Select";
|
||||||
import type { IIncident } from "@/types/incident";
|
import type { IIncident } from "@/types/incident";
|
||||||
import type { IMonitor } from "@/types/monitor";
|
import type { IMonitor } from "@/types/monitor";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useGet, usePatch } from "@/hooks/UseApi";
|
|||||||
import { InfraForm } from "@/pages/infrastructure/InfraForm";
|
import { InfraForm } from "@/pages/infrastructure/InfraForm";
|
||||||
|
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import humanInterval from "human-interval";
|
import humanInterval from "human-interval";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useNavigate } from "react-router";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { monitorSchemaInfra } from "@/validation/zod";
|
import { monitorSchemaInfra } from "@/validation/zod";
|
||||||
import { useGet, usePost } from "@/hooks/UseApi";
|
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";
|
import type { INotificationChannel } from "@/types/notification-channel";
|
||||||
const InfraCreatePage = () => {
|
const InfraCreatePage = () => {
|
||||||
type FormValues = z.infer<typeof monitorSchemaInfra>;
|
type FormValues = z.infer<typeof monitorSchemaInfra>;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useGet, usePatch } from "@/hooks/UseApi";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useParams } from "react-router";
|
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 { IMonitor, IMonitorWithMonitorStats } from "@/types/monitor";
|
||||||
import type { IInfraCheck } from "@/types/check";
|
import type { IInfraCheck } from "@/types/check";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { InfraMonitorsTable } from "./InfraMonitorsTable";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
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 type { IMonitor, IMonitorWithStats } from "@/types/monitor";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { usePatch, useGet, useDelete } from "@/hooks/UseApi";
|
|||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import type { Header } from "@/components/design-elements/Table";
|
import type { Header } from "@/components/design-elements/Table";
|
||||||
import { useTranslation } from "react-i18next";
|
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 { IMaintenance } from "@/types/maintenance";
|
||||||
import type { ActionMenuItem } from "@/components/actions-menu";
|
import type { ActionMenuItem } from "@/components/actions-menu";
|
||||||
import { config } from "@/config/index";
|
import { config } from "@/config/index";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useParams } from "react-router";
|
|||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { usePatch, useGet } from "@/hooks/UseApi";
|
import { usePatch, useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { maintenanceSchema } from "@/validation/zod";
|
import { maintenanceSchema } from "@/validation/zod";
|
||||||
import type { IMonitor } from "@/types/monitor";
|
import type { IMonitor } from "@/types/monitor";
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { MaintenanceForm } from "@/pages/maintenance/MaintenanceForm";
|
|||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { usePost, useGet } from "@/hooks/UseApi";
|
import { usePost, useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { maintenanceSchema } from "@/validation/zod";
|
import { maintenanceSchema } from "@/validation/zod";
|
||||||
import type { IMonitor } from "@/types/monitor";
|
import type { IMonitor } from "@/types/monitor";
|
||||||
import type { IMaintenance } from "@/types/maintenance";
|
import type { IMaintenance } from "@/types/maintenance";
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import type { ActionMenuItem } from "@/components/actions-menu";
|
|||||||
import type { Header } from "@/components/design-elements/Table";
|
import type { Header } from "@/components/design-elements/Table";
|
||||||
import type { INotificationChannel } from "@/types/notification-channel";
|
import type { INotificationChannel } from "@/types/notification-channel";
|
||||||
import { useGet, usePatch, useDelete } from "@/hooks/UseApi";
|
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 { useTranslation } from "react-i18next";
|
||||||
import { config } from "@/config/index";
|
import { config } from "@/config/index";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useParams } from "react-router";
|
|||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { usePatch, useGet } from "@/hooks/UseApi";
|
import { usePatch, useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { notificationChannelSchema } from "@/validation/zod";
|
import { notificationChannelSchema } from "@/validation/zod";
|
||||||
import type { INotificationChannel } from "@/types/notification-channel";
|
import type { INotificationChannel } from "@/types/notification-channel";
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useGet, usePatch } from "@/hooks/UseApi";
|
|||||||
import { PageSpeedForm } from "@/pages/pagespeed/PageSpeedForm";
|
import { PageSpeedForm } from "@/pages/pagespeed/PageSpeedForm";
|
||||||
|
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import humanInterval from "human-interval";
|
import humanInterval from "human-interval";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import humanInterval from "human-interval";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { monitorSchema } from "@/validation/zod";
|
import { monitorSchema } from "@/validation/zod";
|
||||||
import { useGet, usePost } from "@/hooks/UseApi";
|
import { useGet, usePost } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import type { INotificationChannel } from "@/types/notification-channel";
|
import type { INotificationChannel } from "@/types/notification-channel";
|
||||||
const UptimeCreatePage = () => {
|
const UptimeCreatePage = () => {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useState } from "react";
|
|||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useGet, usePatch } from "@/hooks/UseApi";
|
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 type { IMonitor, IMonitorWithMonitorStats } from "@/types/monitor";
|
||||||
import { getStatusPalette } from "@/utils/MonitorUtils";
|
import { getStatusPalette } from "@/utils/MonitorUtils";
|
||||||
import prettyMilliseconds from "pretty-ms";
|
import prettyMilliseconds from "pretty-ms";
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { PageSpeedMonitorTable } from "./PageSpeedMonitorTable";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
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 type { IMonitor, IMonitorWithStats } from "@/types/monitor";
|
||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ProfileForm } from "@/pages/profile/ProfileForm";
|
|||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import type { IUser } from "@/types/user";
|
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 { useGet, usePatch, useGetOnDemand } from "@/hooks/UseApi";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { profileSchema } from "@/validation/zod";
|
import { profileSchema } from "@/validation/zod";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useMemo } from "react";
|
|||||||
import {} from "react-i18next";
|
import {} from "react-i18next";
|
||||||
import { useAppSelector } from "@/hooks/AppHooks";
|
import { useAppSelector } from "@/hooks/AppHooks";
|
||||||
import { useGet, usePatch, usePost } from "@/hooks/UseApi";
|
import { useGet, usePatch, usePost } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { systemSettingsSchema } from "@/validation/zod";
|
import { systemSettingsSchema } from "@/validation/zod";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useParams } from "react-router";
|
|||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { usePatch, useGet } from "@/hooks/UseApi";
|
import { usePatch, useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { statusPageSchema } from "@/validation/zod";
|
import { statusPageSchema } from "@/validation/zod";
|
||||||
import type { IMonitor } from "@/types/monitor";
|
import type { IMonitor } from "@/types/monitor";
|
||||||
import type { IStatusPageWithMonitors } from "@/types/status-page";
|
import type { IStatusPageWithMonitors } from "@/types/status-page";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { StatusPageForm } from "@/pages/status-page/StatusPageForm";
|
|||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { usePost, useGet } from "@/hooks/UseApi";
|
import { usePost, useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { statusPageSchema } from "@/validation/zod";
|
import { statusPageSchema } from "@/validation/zod";
|
||||||
import type { IMonitor } from "@/types/monitor";
|
import type { IMonitor } from "@/types/monitor";
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { BasePage } from "@/components/design-elements";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import type { IMonitor } from "@/types/monitor";
|
import type { IMonitor } from "@/types/monitor";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
import { useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import type { IStatusPageWithMonitors } from "@/types/status-page";
|
import type { IStatusPageWithMonitors } from "@/types/status-page";
|
||||||
import { NameHeader } from "@/components/status-pages/NameHeader";
|
import { NameHeader } from "@/components/status-pages/NameHeader";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { BasePage } from "@/components/design-elements";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import type { IMonitor } from "@/types/monitor";
|
import type { IMonitor } from "@/types/monitor";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
import { useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import type { IStatusPageWithMonitors } from "@/types/status-page";
|
import type { IStatusPageWithMonitors } from "@/types/status-page";
|
||||||
import { NameHeader } from "@/components/status-pages/NameHeader";
|
import { NameHeader } from "@/components/status-pages/NameHeader";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { StatusPageTable } from "@/pages/status-page/StatusPageTable";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import type { IStatusPage } from "@/types/status-page";
|
import type { IStatusPage } from "@/types/status-page";
|
||||||
import { useGet, useDelete } from "@/hooks/UseApi";
|
import { useGet, useDelete } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { config } from "@/config/index";
|
import { config } from "@/config/index";
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useNavigate } from "react-router";
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
import { useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import type { ITeamMember } from "@/types/team-member";
|
import type { ITeamMember } from "@/types/team-member";
|
||||||
|
|
||||||
const TeamDetailsPage = () => {
|
const TeamDetailsPage = () => {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Dialog } from "@/components/inputs";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useGet, usePatch, useGetOnDemand } from "@/hooks/UseApi";
|
import { useGet, usePatch, useGetOnDemand } from "@/hooks/UseApi";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { useDelete } from "@/hooks/UseApi";
|
import { useDelete } from "@/hooks/UseApi";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { TeamMemberForm } from "./TeamMemberForm";
|
|||||||
|
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import { useGet, usePost } from "@/hooks/UseApi";
|
import { useGet, usePost } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { mutate } from "swr";
|
import { mutate } from "swr";
|
||||||
import { useGetOnDemand } from "@/hooks/UseApi";
|
import { useGetOnDemand } from "@/hooks/UseApi";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { useNavigate } from "react-router";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import type { ActionMenuItem } from "@/components/actions-menu";
|
import type { ActionMenuItem } from "@/components/actions-menu";
|
||||||
import type { Header } from "@/components/design-elements/Table";
|
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 { useGet, useDelete } from "@/hooks/UseApi";
|
||||||
import type { ITeam } from "@/types/team";
|
import type { ITeam } from "@/types/team";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useNavigate, useParams } from "react-router";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { teamSchema } from "@/validation/zod";
|
import { teamSchema } from "@/validation/zod";
|
||||||
import { useGet, usePatch, useGetOnDemand } from "@/hooks/UseApi";
|
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 type { IUser } from "@/types/user";
|
||||||
import { useAppDispatch } from "@/hooks/AppHooks";
|
import { useAppDispatch } from "@/hooks/AppHooks";
|
||||||
import { setUser } from "@/features/authSlice";
|
import { setUser } from "@/features/authSlice";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useNavigate } from "react-router";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { teamSchema } from "@/validation/zod";
|
import { teamSchema } from "@/validation/zod";
|
||||||
import { useGet, usePost, useGetOnDemand } from "@/hooks/UseApi";
|
import { useGet, usePost, useGetOnDemand } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { mutate } from "swr";
|
import { mutate } from "swr";
|
||||||
import type { IUser } from "@/types/user";
|
import type { IUser } from "@/types/user";
|
||||||
import { useAppDispatch } from "@/hooks/AppHooks";
|
import { useAppDispatch } from "@/hooks/AppHooks";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Box from "@mui/material/Box";
|
|||||||
|
|
||||||
import type { Header } from "@/components/design-elements/Table";
|
import type { Header } from "@/components/design-elements/Table";
|
||||||
import type { ICheck, IChecksWithCount } from "@/types/check";
|
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 type { MonitorStatus } from "@/types/monitor";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useGet, usePatch } from "@/hooks/UseApi";
|
|||||||
import { UptimeForm } from "@/pages/uptime/UptimeForm";
|
import { UptimeForm } from "@/pages/uptime/UptimeForm";
|
||||||
|
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import humanInterval from "human-interval";
|
import humanInterval from "human-interval";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import humanInterval from "human-interval";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { monitorSchema } from "@/validation/zod";
|
import { monitorSchema } from "@/validation/zod";
|
||||||
import { useGet, usePost } from "@/hooks/UseApi";
|
import { useGet, usePost } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import type { INotificationChannel } from "@/types/notification-channel";
|
import type { INotificationChannel } from "@/types/notification-channel";
|
||||||
const UptimeCreatePage = () => {
|
const UptimeCreatePage = () => {
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import type { IMonitor, IMonitorWithMonitorStats } from "@/types/monitor";
|
|||||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useParams } from "react-router";
|
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 { useState } from "react";
|
||||||
import { getStatusPalette } from "@/utils/MonitorUtils";
|
import { getStatusPalette } from "@/utils/MonitorUtils";
|
||||||
import prettyMilliseconds from "pretty-ms";
|
import prettyMilliseconds from "pretty-ms";
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { InitializingStatusBox } from "@/components/design-elements/StatusBox";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
import { useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/types/api";
|
||||||
import {
|
import {
|
||||||
type IMonitor,
|
type IMonitor,
|
||||||
type IMonitorWithStats,
|
type IMonitorWithStats,
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export type ApiResponse<T> = {
|
||||||
|
message: string;
|
||||||
|
data: T;
|
||||||
|
};
|
||||||
|
|
||||||
Reference in new issue
Block a user