19 lines
533 B
TypeScript
19 lines
533 B
TypeScript
import api from './api';
|
|
import { Operation } from '../types/Operation'; // ID: type-import-fix
|
|
|
|
export const operationService = {
|
|
getAll: async (): Promise<Operation[]> => {
|
|
const response = await api.get<Operation[]>('/operations');
|
|
return response.data;
|
|
},
|
|
|
|
create: async (name: string): Promise<Operation> => {
|
|
const response = await api.post<Operation>('/operations', { name });
|
|
return response.data;
|
|
},
|
|
|
|
delete: async (id: number): Promise<void> => {
|
|
await api.delete(`/operations/${id}`);
|
|
}
|
|
};
|