14 lines
516 B
TypeScript
14 lines
516 B
TypeScript
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, true);
|
|
|
|
return { getMeta, postContact };
|
|
};
|