Use server actions instead of client-side API calls
This commit is contained in:
parent
5a3127dcb0
commit
aa453954ed
30 changed files with 703 additions and 462 deletions
16
apps/link/app/_actions/groups.ts
Normal file
16
apps/link/app/_actions/groups.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use server";
|
||||
|
||||
import { executeREST } from "app/_lib/zammad";
|
||||
|
||||
export const getGroupsAction = async () => {
|
||||
const groups = await executeREST({
|
||||
path: "/api/v1/groups",
|
||||
});
|
||||
const allGroups = groups ?? [];
|
||||
const formattedGroups = allGroups.map((group: any) => ({
|
||||
label: group.name,
|
||||
value: `gid://zammad/Group/${group.id}`,
|
||||
}));
|
||||
|
||||
return formattedGroups;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue