update user detail
This commit is contained in:
@@ -4,7 +4,26 @@ import { withCurrentStoreId, withCurrentStorePage } from "@/utils/store";
|
||||
|
||||
const BASE_URI = "/gao/user";
|
||||
|
||||
async function list(page: Page<ManagedUser>): Promise<PageResult<ManagedUser>> {
|
||||
type ListOptions = {
|
||||
allStores?: boolean;
|
||||
storeId?: string;
|
||||
};
|
||||
|
||||
async function list(page: Page<ManagedUser>, options?: ListOptions): Promise<PageResult<ManagedUser>> {
|
||||
if (options?.allStores) {
|
||||
return await axios.post(`${BASE_URI}/list`, page);
|
||||
}
|
||||
|
||||
if (options?.storeId) {
|
||||
return await axios.post(`${BASE_URI}/list`, {
|
||||
...page,
|
||||
equalsExample: {
|
||||
...(page.equalsExample || {}),
|
||||
storeId: options.storeId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return await axios.post(`${BASE_URI}/list`, withCurrentStorePage(page));
|
||||
}
|
||||
|
||||
@@ -22,6 +41,10 @@ async function update(user: ManagedUser): Promise<ManagedUser> {
|
||||
return await axios.post(`${BASE_URI}/update`, withCurrentStoreId(user));
|
||||
}
|
||||
|
||||
async function transferStore(user: ManagedUser): Promise<ManagedUser> {
|
||||
return await axios.post(`${BASE_URI}/transfer/store`, user);
|
||||
}
|
||||
|
||||
async function remove(id: string): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/delete`, undefined, {
|
||||
params: { id }
|
||||
@@ -37,6 +60,7 @@ export default {
|
||||
detail,
|
||||
create,
|
||||
update,
|
||||
transferStore,
|
||||
remove,
|
||||
roleList
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user