Zammad send fixes, update deps
This commit is contained in:
parent
c47223f5e9
commit
a4053e6412
29 changed files with 626 additions and 500 deletions
|
|
@ -3,48 +3,63 @@
|
|||
import { executeREST } from "app/_lib/zammad";
|
||||
|
||||
export const getAgentsAction = async () => {
|
||||
const users = await executeREST({
|
||||
path: "/api/v1/users",
|
||||
});
|
||||
const agents = users?.filter((user: any) => user.role_ids.includes(2)) ?? [];
|
||||
const formattedAgents = agents
|
||||
.map((agent: any) => ({
|
||||
label: `${agent.firstname} ${agent.lastname}`,
|
||||
value: `gid://zammad/User/${agent.id}`,
|
||||
}))
|
||||
.sort((a: any, b: any) => a.label.localeCompare(b.label));
|
||||
try {
|
||||
const users = await executeREST({
|
||||
path: "/api/v1/users",
|
||||
});
|
||||
const agents =
|
||||
users?.filter((user: any) => user.role_ids.includes(2)) ?? [];
|
||||
const formattedAgents = agents
|
||||
.map((agent: any) => ({
|
||||
label: `${agent.firstname} ${agent.lastname}`,
|
||||
value: `gid://zammad/User/${agent.id}`,
|
||||
}))
|
||||
.sort((a: any, b: any) => a.label.localeCompare(b.label));
|
||||
|
||||
return formattedAgents;
|
||||
return formattedAgents;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const getCustomersAction = async () => {
|
||||
const users = await executeREST({
|
||||
path: "/api/v1/users",
|
||||
});
|
||||
console.log({ users });
|
||||
const customers =
|
||||
users?.filter((user: any) => user.role_ids.includes(3)) ?? [];
|
||||
const formattedCustomers = customers
|
||||
.map((customer: any) => ({
|
||||
label: customer.login,
|
||||
value: `gid://zammad/User/${customer.id}`,
|
||||
}))
|
||||
.sort((a: any, b: any) => a.label.localeCompare(b.label));
|
||||
try {
|
||||
const users = await executeREST({
|
||||
path: "/api/v1/users",
|
||||
});
|
||||
const customers =
|
||||
users?.filter((user: any) => user.role_ids.includes(3)) ?? [];
|
||||
const formattedCustomers = customers
|
||||
.map((customer: any) => ({
|
||||
label: customer.login,
|
||||
value: `gid://zammad/User/${customer.id}`,
|
||||
}))
|
||||
.sort((a: any, b: any) => a.label.localeCompare(b.label));
|
||||
|
||||
return formattedCustomers;
|
||||
return formattedCustomers;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const getUsersAction = async () => {
|
||||
const users = await executeREST({
|
||||
path: "/api/v1/users",
|
||||
});
|
||||
console.log({ users });
|
||||
const formattedUsers = users
|
||||
.map((customer: any) => ({
|
||||
label: customer.login,
|
||||
value: `gid://zammad/User/${customer.id}`,
|
||||
}))
|
||||
.sort((a: any, b: any) => a.label.localeCompare(b.label));
|
||||
try {
|
||||
const users = await executeREST({
|
||||
path: "/api/v1/users",
|
||||
});
|
||||
console.log({ users });
|
||||
const formattedUsers = users
|
||||
.map((customer: any) => ({
|
||||
label: customer.login,
|
||||
value: `gid://zammad/User/${customer.id}`,
|
||||
}))
|
||||
.sort((a: any, b: any) => a.label.localeCompare(b.label));
|
||||
|
||||
return formattedUsers;
|
||||
return formattedUsers;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue