mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-04-04 19:27:32 +00:00
init
This commit is contained in:
38
frontend/src/composables/department/useDepartmentBind.ts
Normal file
38
frontend/src/composables/department/useDepartmentBind.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import client from "@/api/client";
|
||||
|
||||
export function useDepartmentBind() {
|
||||
const bindDepartment = async (userId: number, departmentIds: number[]) => {
|
||||
try {
|
||||
await client.POST("/iam/department/bind", {
|
||||
body: {
|
||||
userId,
|
||||
departmentIds,
|
||||
},
|
||||
});
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error("Error binding departments:", error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const unbindDepartment = async (userId: number, departmentIds: number[]) => {
|
||||
try {
|
||||
await client.POST("/iam/department/unbind", {
|
||||
body: {
|
||||
userId,
|
||||
departmentIds,
|
||||
},
|
||||
});
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error("Error unbinding departments:", error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
bindDepartment,
|
||||
unbindDepartment,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user