Email redirect and group dropdown fixes
This commit is contained in:
parent
7ad25e8a95
commit
84731c9e9a
5 changed files with 24 additions and 14 deletions
|
|
@ -2,13 +2,16 @@
|
|||
|
||||
import { executeREST } from "app/_lib/zammad";
|
||||
|
||||
export const getAgentsAction = async () => {
|
||||
export const getAgentsAction = async (groupID: number) => {
|
||||
try {
|
||||
const users = await executeREST({
|
||||
path: "/api/v1/users",
|
||||
const group = await executeREST({
|
||||
path: `/api/v1/groups/${groupID}`,
|
||||
});
|
||||
const { user_ids: groupUserIDs } = group;
|
||||
const path = `/api/v1/users/search?query=role_ids:2&limit=1000`;
|
||||
const users = await executeREST({ path });
|
||||
const agents =
|
||||
users?.filter((user: any) => user.role_ids.includes(2)) ?? [];
|
||||
users?.filter((user: any) => groupUserIDs.includes(user.id)) ?? [];
|
||||
const formattedAgents = agents
|
||||
.map((agent: any) => ({
|
||||
label: `${agent.firstname} ${agent.lastname}`,
|
||||
|
|
@ -49,7 +52,6 @@ export const getUsersAction = async () => {
|
|||
const users = await executeREST({
|
||||
path: "/api/v1/users",
|
||||
});
|
||||
console.log({ users });
|
||||
const formattedUsers = users
|
||||
.map((customer: any) => ({
|
||||
label: customer.login,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue