23 lines
747 B
TypeScript
23 lines
747 B
TypeScript
import type * as ELT from './types';
|
|
import getUrls from '@/config/urls';
|
|
import type { QueryFunctionContext } from '@tanstack/react-query';
|
|
import axios from 'axios';
|
|
|
|
const { URL_ELT_KASKO, URL_ELT_OSAGO } = getUrls();
|
|
|
|
export async function getEltOsago(
|
|
payload: ELT.RequestEltOsago,
|
|
{ signal }: QueryFunctionContext
|
|
): Promise<ELT.ResponseEltOsago> {
|
|
return await axios
|
|
.post<ELT.ResponseEltOsago>(URL_ELT_OSAGO, payload, { signal })
|
|
.then((response) => response.data)
|
|
.catch((error) => error.response.data);
|
|
}
|
|
|
|
export async function getEltKasko(payload: ELT.RequestEltKasko, { signal }: QueryFunctionContext) {
|
|
const { data } = await axios.post<ELT.ResponseEltKasko>(URL_ELT_KASKO, payload, { signal });
|
|
|
|
return data;
|
|
}
|