2024-08-05 23:31:15 +02:00
|
|
|
"use server";
|
|
|
|
|
import { executeGraphQL } from "app/_lib/zammad";
|
|
|
|
|
import { searchQuery } from "@/app/_graphql/searchQuery";
|
|
|
|
|
|
|
|
|
|
export const searchAllAction = async (query: string, limit: number) => {
|
2024-08-14 10:51:12 +02:00
|
|
|
try {
|
|
|
|
|
const result = await executeGraphQL({
|
|
|
|
|
query: searchQuery,
|
|
|
|
|
variables: { search: query, limit },
|
|
|
|
|
});
|
2024-08-05 23:31:15 +02:00
|
|
|
|
2024-08-14 10:51:12 +02:00
|
|
|
return result?.search;
|
|
|
|
|
} catch (e) {
|
2024-08-14 13:03:50 +02:00
|
|
|
console.error(e.message);
|
2024-08-14 10:51:12 +02:00
|
|
|
return [];
|
|
|
|
|
}
|
2024-08-05 23:31:15 +02:00
|
|
|
};
|