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 { 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";
|
||||
|
||||
|
||||
@@ -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<T> = {
|
||||
message: string;
|
||||
data: T;
|
||||
};
|
||||
import type { ApiResponse } from "@/types/api";
|
||||
|
||||
export interface IExtraConfig {
|
||||
useTeamIdAsKey?: boolean;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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<typeof monitorSchemaInfra>;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export type ApiResponse<T> = {
|
||||
message: string;
|
||||
data: T;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user