// Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ import { QueryHandler } from '#shared/server/apollo/handler/index.ts' import { useLocalesLazyQuery } from '#shared/graphql/queries/locales.api.ts' import type { LocalesQuery } from '#shared/graphql/types.ts' let availableLocales: Maybe const getAvailableLocales = async (): Promise< Maybe > => { if (availableLocales !== undefined) return availableLocales const query = new QueryHandler(useLocalesLazyQuery({ onlyActive: true })) const { data: result } = await query.query() availableLocales = result?.locales || null return availableLocales } export default getAvailableLocales