fix api types, add more form fields

This commit is contained in:
uubulb
2024-11-15 21:28:48 +08:00
parent 08560316a0
commit b1a9a231a7
5 changed files with 432 additions and 354 deletions
+1 -1
View File
@@ -58,4 +58,4 @@ export async function fetcher<T>(method: FetcherMethod, path: string, data?: any
export async function swrFetcher<T>(input: string | URL | globalThis.Request, init?: RequestInit) {
return fetcher<T>(init?.method as FetcherMethod, input.toString(), init?.body);
}
}
+14
View File
@@ -0,0 +1,14 @@
import { ModelServiceForm } from "@/types"
import { fetcher, FetcherMethod } from "./api"
export const createService = async (data: ModelServiceForm): Promise<number> => {
return fetcher<number>(FetcherMethod.POST, '/api/v1/profile', data)
}
export const updateService = async (id: number, data: ModelServiceForm): Promise<void> => {
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/profile/${id}`, data)
}
export const deleteService = async (id: number[]): Promise<void> => {
return fetcher<void>(FetcherMethod.POST, '/api/v1/batch-delete/service', id)
}