43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { axios, type Page, type PageResult, type Role } from "timi-web";
|
|
import type { ManagedUser } from "@/types/ManagedUser";
|
|
import { withCurrentStoreId, withCurrentStorePage } from "@/utils/store";
|
|
|
|
const BASE_URI = "/gao/user";
|
|
|
|
async function list(page: Page<ManagedUser>): Promise<PageResult<ManagedUser>> {
|
|
return await axios.post(`${BASE_URI}/list`, withCurrentStorePage(page));
|
|
}
|
|
|
|
async function detail(id: string): Promise<ManagedUser> {
|
|
return await axios.post(`${BASE_URI}/detail`, undefined, {
|
|
params: { id }
|
|
});
|
|
}
|
|
|
|
async function create(user: ManagedUser): Promise<ManagedUser> {
|
|
return await axios.post(`${BASE_URI}/create`, withCurrentStoreId(user));
|
|
}
|
|
|
|
async function update(user: ManagedUser): Promise<ManagedUser> {
|
|
return await axios.post(`${BASE_URI}/update`, withCurrentStoreId(user));
|
|
}
|
|
|
|
async function remove(id: string): Promise<void> {
|
|
return await axios.post(`${BASE_URI}/delete`, undefined, {
|
|
params: { id }
|
|
});
|
|
}
|
|
|
|
async function roleList(): Promise<Role[]> {
|
|
return await axios.post(`${BASE_URI}/role/list`);
|
|
}
|
|
|
|
export default {
|
|
list,
|
|
detail,
|
|
create,
|
|
update,
|
|
remove,
|
|
roleList
|
|
};
|