import type { ContactRequest, ContactResponse } from '~/types/api/contact';
import type { MetaResponse } from '~/types/api/meta';
import type { UseApiResponse } from './useApi';

export const useBackend = () => {
  const api = useApi();

  const getMeta = (): UseApiResponse<MetaResponse> => api.get<MetaResponse>('/meta');
  const postContact = (): UseApiResponse<ContactResponse, ContactRequest> =>
    api.post<ContactResponse, ContactRequest>('/contact', undefined, false);

  return { getMeta, postContact };
};
