26 lines
918 B
TypeScript
26 lines
918 B
TypeScript
|
|
import apiClient from '../apiClient';
|
||
|
|
import type { AjusteDto } from '../../models/dtos/Suscripciones/AjusteDto';
|
||
|
|
import type { CreateAjusteDto } from '../../models/dtos/Suscripciones/CreateAjusteDto';
|
||
|
|
|
||
|
|
const API_URL_BY_SUSCRIPTOR = '/suscriptores';
|
||
|
|
const API_URL_BASE = '/ajustes';
|
||
|
|
|
||
|
|
const getAjustesPorSuscriptor = async (idSuscriptor: number): Promise<AjusteDto[]> => {
|
||
|
|
const response = await apiClient.get<AjusteDto[]>(`${API_URL_BY_SUSCRIPTOR}/${idSuscriptor}/ajustes`);
|
||
|
|
return response.data;
|
||
|
|
};
|
||
|
|
|
||
|
|
const createAjusteManual = async (data: CreateAjusteDto): Promise<AjusteDto> => {
|
||
|
|
const response = await apiClient.post<AjusteDto>(API_URL_BASE, data);
|
||
|
|
return response.data;
|
||
|
|
};
|
||
|
|
|
||
|
|
const anularAjuste = async (idAjuste: number): Promise<void> => {
|
||
|
|
await apiClient.post(`${API_URL_BASE}/${idAjuste}/anular`);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default {
|
||
|
|
getAjustesPorSuscriptor,
|
||
|
|
createAjusteManual,
|
||
|
|
anularAjuste
|
||
|
|
};
|