53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import { axios } from "timi-web-api";
|
|
import type { Page, PageResult } from "timi-web-api";
|
|
import type { Tag, TagApply, TagBizType } from "@/types/Tag";
|
|
|
|
const BASE_URI = "/gao/tag";
|
|
|
|
async function list(page: Page<Tag>): Promise<PageResult<Tag>> {
|
|
return await axios.post(`${BASE_URI}/list`, page);
|
|
}
|
|
|
|
async function detail(id: string): Promise<Tag> {
|
|
return await axios.post(`${BASE_URI}/detail`, undefined, {
|
|
params: { id }
|
|
});
|
|
}
|
|
|
|
async function create(tag: Tag): Promise<Tag> {
|
|
return await axios.post(`${BASE_URI}/create`, tag);
|
|
}
|
|
|
|
async function update(tag: Tag): Promise<void> {
|
|
return await axios.post(`${BASE_URI}/update`, tag);
|
|
}
|
|
|
|
async function remove(id: string): Promise<void> {
|
|
return await axios.post(`${BASE_URI}/delete`, undefined, {
|
|
params: { id }
|
|
});
|
|
}
|
|
|
|
async function listByBizType(bizType: TagBizType, bizId: string): Promise<Tag[]> {
|
|
return await axios.get(`${BASE_URI}/list/biz/id`, {
|
|
params: {
|
|
bizType,
|
|
bizId
|
|
}
|
|
});
|
|
}
|
|
|
|
async function apply(req: TagApply): Promise<void> {
|
|
return await axios.post(`${BASE_URI}/apply`, req);
|
|
}
|
|
|
|
export default {
|
|
list,
|
|
detail,
|
|
create,
|
|
update,
|
|
remove,
|
|
listByBizType,
|
|
apply
|
|
};
|