mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-09-19 09:40:13 +00:00
implement cron page (#7)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { ModelCronForm } from "@/types"
|
||||
import { fetcher, FetcherMethod } from "./api"
|
||||
|
||||
export const createCron = async (data: ModelCronForm): Promise<number> => {
|
||||
return fetcher<number>(FetcherMethod.POST, '/api/v1/cron', data);
|
||||
}
|
||||
|
||||
export const updateCron = async (id: number, data: ModelCronForm): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/cron/${id}`, data);
|
||||
}
|
||||
|
||||
export const deleteCron = async (id: number[]): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/cron', id);
|
||||
}
|
||||
|
||||
export const runCron = async (id: number): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.GET, `/api/v1/cron/${id}/manual`, null);
|
||||
}
|
||||
+4
-4
@@ -2,17 +2,17 @@ import { ModelDDNSForm } from "@/types"
|
||||
import { fetcher, FetcherMethod } from "./api"
|
||||
|
||||
export const createDDNSProfile = async (data: ModelDDNSForm): Promise<number> => {
|
||||
return fetcher<number>(FetcherMethod.POST, '/api/v1/ddns', data)
|
||||
return fetcher<number>(FetcherMethod.POST, '/api/v1/ddns', data);
|
||||
}
|
||||
|
||||
export const updateDDNSProfile = async (id: number, data: ModelDDNSForm): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/ddns/${id}`, data)
|
||||
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/ddns/${id}`, data);
|
||||
}
|
||||
|
||||
export const deleteDDNSProfiles = async (id: number[]): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/ddns', id)
|
||||
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/ddns', id);
|
||||
}
|
||||
|
||||
export const getDDNSProviders = async (): Promise<string[]> => {
|
||||
return fetcher<string[]>(FetcherMethod.GET, '/api/v1/ddns/providers', null)
|
||||
return fetcher<string[]>(FetcherMethod.GET, '/api/v1/ddns/providers', null);
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@ import { ModelNATForm } from "@/types"
|
||||
import { fetcher, FetcherMethod } from "./api"
|
||||
|
||||
export const createNAT = async (data: ModelNATForm): Promise<number> => {
|
||||
return fetcher<number>(FetcherMethod.POST, '/api/v1/nat', data)
|
||||
return fetcher<number>(FetcherMethod.POST, '/api/v1/nat', data);
|
||||
}
|
||||
|
||||
export const updateNAT = async (id: number, data: ModelNATForm): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/nat/${id}`, data)
|
||||
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/nat/${id}`, data);
|
||||
}
|
||||
|
||||
export const deleteNAT = async (id: number[]): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/nat', id)
|
||||
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/nat', id);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@ export const updateNotificationGroup = async (id: number, data: ModelNotificatio
|
||||
}
|
||||
|
||||
export const deleteNotificationGroups = async (id: number[]): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.POST, `/api/v1/batch-delete/notification-group`, id)
|
||||
return fetcher<void>(FetcherMethod.POST, `/api/v1/batch-delete/notification-group`, id);
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ export const updateServerGroup = async (id: number, data: ModelServerGroupForm):
|
||||
}
|
||||
|
||||
export const deleteServerGroups = async (id: number[]): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.POST, `/api/v1/batch-delete/server-group`, id)
|
||||
return fetcher<void>(FetcherMethod.POST, `/api/v1/batch-delete/server-group`, id);
|
||||
}
|
||||
|
||||
export const getServerGroups = async (): Promise<ModelServerGroupResponseItem[]> => {
|
||||
return fetcher<ModelServerGroupResponseItem[]>(FetcherMethod.GET, '/api/v1/server-group', null)
|
||||
return fetcher<ModelServerGroupResponseItem[]>(FetcherMethod.GET, '/api/v1/server-group', null);
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@ import { ModelServer, ModelServerForm } from "@/types"
|
||||
import { fetcher, FetcherMethod } from "./api"
|
||||
|
||||
export const updateServer = async (id: number, data: ModelServerForm): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/server/${id}`, data)
|
||||
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/server/${id}`, data);
|
||||
}
|
||||
|
||||
export const deleteServer = async (id: number[]): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/server', id)
|
||||
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/server', id);
|
||||
}
|
||||
|
||||
export const getServers = async (): Promise<ModelServer[]> => {
|
||||
return fetcher<ModelServer[]>(FetcherMethod.GET, '/api/v1/server', null)
|
||||
return fetcher<ModelServer[]>(FetcherMethod.GET, '/api/v1/server', null);
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@ import { ModelServiceForm } from "@/types"
|
||||
import { fetcher, FetcherMethod } from "./api"
|
||||
|
||||
export const createService = async (data: ModelServiceForm): Promise<number> => {
|
||||
return fetcher<number>(FetcherMethod.POST, '/api/v1/service', data)
|
||||
return fetcher<number>(FetcherMethod.POST, '/api/v1/service', data);
|
||||
}
|
||||
|
||||
export const updateService = async (id: number, data: ModelServiceForm): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/service/${id}`, data)
|
||||
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/service/${id}`, data);
|
||||
}
|
||||
|
||||
export const deleteService = async (id: number[]): Promise<void> => {
|
||||
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/service', id)
|
||||
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/service', id);
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@ import { ModelUser } from "@/types"
|
||||
import { fetcher, FetcherMethod } from "./api"
|
||||
|
||||
export const getProfile = async (): Promise<ModelUser> => {
|
||||
return fetcher<ModelUser>(FetcherMethod.GET, '/api/v1/profile', null)
|
||||
return fetcher<ModelUser>(FetcherMethod.GET, '/api/v1/profile', null);
|
||||
}
|
||||
|
||||
export const login = async (username: string, password: string): Promise<any> => {
|
||||
return fetcher<any>(FetcherMethod.POST, '/api/v1/login', { username, password })
|
||||
return fetcher<any>(FetcherMethod.POST, '/api/v1/login', { username, password });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user