Khởi tạo ban đầu

This commit is contained in:
Tran Anh Tuan
2025-11-28 16:59:57 +07:00
parent 2911be97b2
commit 4ba46a7df2
131 changed files with 28066 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import { api } from "@/config";
import {
API_GET_ALARMS,
API_GET_GPS,
API_PATH_ENTITIES,
API_PATH_SHIP_TRACK_POINTS,
API_SOS,
} from "@/constants";
import { transformEntityResponse } from "@/utils/tranform";
export async function queryGpsData() {
return api.get<Model.GPSResponse>(API_GET_GPS);
}
export async function queryAlarm() {
return api.get<Model.AlarmResponse>(API_GET_ALARMS);
}
export async function queryTrackPoints() {
return api.get<Model.ShipTrackPoint[]>(API_PATH_SHIP_TRACK_POINTS);
}
export async function queryEntities(): Promise<Model.TransformedEntity[]> {
const response = await api.get<Model.EntityResponse[]>(API_PATH_ENTITIES);
return response.data.map(transformEntityResponse);
}
export async function queryGetSos() {
return await api.get<Model.SosResponse>(API_SOS);
}
export async function queryDeleteSos() {
return await api.delete<Model.SosResponse>(API_SOS);
}
export async function querySendSosMessage(message: string) {
return await api.put<Model.SosRequest>(API_SOS, { message });
}