implement notification page (#8)

This commit is contained in:
UUBulb
2024-11-20 21:37:03 +08:00
committed by GitHub
parent 0e4bcd3938
commit 059c33eda4
27 changed files with 1133 additions and 36 deletions
+14
View File
@@ -0,0 +1,14 @@
import { ModelAlertRuleForm } from "@/types"
import { fetcher, FetcherMethod } from "./api"
export const createAlertRule = async (data: ModelAlertRuleForm): Promise<number> => {
return fetcher<number>(FetcherMethod.POST, '/api/v1/alert-rule', data);
}
export const updateAlertRule = async (id: number, data: ModelAlertRuleForm): Promise<void> => {
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/alert-rule/${id}`, data);
}
export const deleteAlertRules = async (id: number[]): Promise<void> => {
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/alert-rule', id);
}
+5 -1
View File
@@ -1,4 +1,4 @@
import { ModelNotificationGroupForm } from "@/types"
import { ModelNotificationGroupForm, ModelNotificationGroupResponseItem } from "@/types"
import { fetcher, FetcherMethod } from "./api"
export const createNotificationGroup = async (data: ModelNotificationGroupForm): Promise<number> => {
@@ -12,3 +12,7 @@ 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);
}
export const getNotificationGroups = async (): Promise<ModelNotificationGroupResponseItem[]> => {
return fetcher<ModelNotificationGroupResponseItem[]>(FetcherMethod.GET, '/api/v1/notification-group', null);
}
+18
View File
@@ -0,0 +1,18 @@
import { ModelNotificationForm, ModelNotification } from "@/types"
import { fetcher, FetcherMethod } from "./api"
export const createNotification = async (data: ModelNotificationForm): Promise<number> => {
return fetcher<number>(FetcherMethod.POST, '/api/v1/notification', data);
}
export const updateNotification = async (id: number, data: ModelNotificationForm): Promise<void> => {
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/notification/${id}`, data);
}
export const deleteNotification = async (id: number[]): Promise<void> => {
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/notification', id);
}
export const getNotification = async (): Promise<ModelNotification[]> => {
return fetcher<ModelNotification[]>(FetcherMethod.GET, '/api/v1/notification', null);
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { ModelTerminalForm, ModelCreateTerminalResponse } from "@/types";
import { ModelCreateTerminalResponse } from "@/types";
import { fetcher, FetcherMethod } from "./api"
export const createTerminal = async (id: number): Promise<ModelCreateTerminalResponse> => {