import { LegalInterface } from './legal.types'; import { directus } from '@/plugins/axios'; import { IParamsDirectus } from '../baseTypes'; export async function getLegal(slug: string): Promise { const params: IParamsDirectus = { filter: { slug }, fields: '*.*' }; const { data: legals } = await directus.get( 'legals', { params, }, ); const [legal] = legals.data; return legal; } export async function getAll(): Promise { const { data: legal } = await directus.get('legals'); return legal.data; } export const LegalGateway = { getAll, getLegal, };