Files
SMATEC-FRONTEND/src/services/slave/sgw/FishController.ts

37 lines
963 B
TypeScript

import {
SGW_ROUTE_CREATE_OR_UPDATE_FISH,
SGW_ROUTE_GET_FISH,
} from '@/constants/slave/sgw/routes';
import { request } from '@umijs/max';
export async function apiGetFishSpecies(
body?: SgwModel.SearchFishPaginationBody,
): Promise<SgwModel.FishSpeciesResponse> {
return request<SgwModel.FishSpeciesResponse>(SGW_ROUTE_GET_FISH, {
method: 'POST',
data: body,
});
}
export async function apiCreateFishSpecies(body?: SgwModel.Fish) {
return request<SgwModel.CreateFishResponse>(SGW_ROUTE_CREATE_OR_UPDATE_FISH, {
method: 'POST',
data: [body],
getResponse: true,
});
}
export async function apiUpdateFishSpecies(body?: SgwModel.Fish) {
return request(SGW_ROUTE_CREATE_OR_UPDATE_FISH, {
method: 'PUT',
data: body,
getResponse: true,
});
}
export async function apiDeleteFishSpecies(id?: string) {
return request(`${SGW_ROUTE_CREATE_OR_UPDATE_FISH}/${id}`, {
method: 'DELETE',
getResponse: true,
});
}