"use server";
import { executeGraphQL } from "app/_lib/zammad";
import { searchQuery } from "@/app/_graphql/searchQuery";

export const searchAllAction = async (query: string, limit: number) => {
  try {
    const result = await executeGraphQL({
      query: searchQuery,
      variables: { search: query, limit },
    });

    return result?.search;
  } catch (e) {
    console.error(e.message);
    return [];
  }
};
