refactor event
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { axios, type Page, type PageResult } from "timi-web";
|
||||
import type { EventItem } from "@/types/EventItem";
|
||||
|
||||
const BASE_URI = "/gao/event";
|
||||
|
||||
async function list(req: Page<EventItem>): Promise<PageResult<EventItem>> {
|
||||
return await axios.post(`${BASE_URI}/list`, req);
|
||||
}
|
||||
|
||||
async function enabledList(): Promise<EventItem[]> {
|
||||
return await axios.post(`${BASE_URI}/list/valid`);
|
||||
}
|
||||
|
||||
async function detail(id: string): Promise<EventItem> {
|
||||
return await axios.post(`${BASE_URI}/detail`, undefined, {
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
async function create(req: EventItem): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/create`, req);
|
||||
}
|
||||
|
||||
async function update(req: EventItem): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/update`, req);
|
||||
}
|
||||
|
||||
async function sort(idList: string[]): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/sort`, idList);
|
||||
}
|
||||
|
||||
async function remove(id: string): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/delete`, undefined, {
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
list,
|
||||
enabledList,
|
||||
detail,
|
||||
create,
|
||||
update,
|
||||
sort,
|
||||
remove
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user