43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { api } from "@/config";
|
|
import {
|
|
API_GET_ALL_SHIP,
|
|
API_GET_PHOTO,
|
|
API_GET_SHIP_GROUPS,
|
|
API_GET_SHIP_TYPES,
|
|
API_PATH_SEARCH_THINGS,
|
|
} from "@/constants";
|
|
|
|
export async function querySearchThings(body: Model.SearchThingBody) {
|
|
return await api.post<Model.ThingsResponse>(API_PATH_SEARCH_THINGS, body);
|
|
}
|
|
|
|
export async function queryShipTypes() {
|
|
return await api.get<Model.ShipType[]>(API_GET_SHIP_TYPES);
|
|
}
|
|
|
|
export async function queryShipGroups() {
|
|
return await api.get<Model.ShipGroup[]>(API_GET_SHIP_GROUPS);
|
|
}
|
|
|
|
export async function queryAllShips(params: Model.SearchThingBody) {
|
|
return await api.get<Model.ShipResponse>(API_GET_ALL_SHIP, {
|
|
params: params,
|
|
});
|
|
}
|
|
|
|
export async function queryShipsImage(ship_id: string) {
|
|
return await api.get(`${API_GET_PHOTO}/ship/${ship_id}/main`, {
|
|
responseType: "arraybuffer",
|
|
});
|
|
}
|
|
|
|
export async function queryCreateShip(body: Model.ShipBodyRequest) {
|
|
return await api.post(`${API_GET_ALL_SHIP}`, body);
|
|
}
|
|
export async function queryUpdateShip(
|
|
shipId: string,
|
|
body: Model.ShipBodyRequest
|
|
) {
|
|
return await api.put(`${API_GET_ALL_SHIP}/${shipId}`, body);
|
|
}
|