thêm toast, thêm logic cho phần ButtonCreateNewHaulOrTrip

This commit is contained in:
Tran Anh Tuan
2025-11-06 17:30:04 +07:00
parent 1ef83c9b22
commit aabd1109b2
15 changed files with 799 additions and 119 deletions

View File

@@ -9,7 +9,7 @@ import {
import { transformEntityResponse } from "@/utils/tranform";
export async function queryGpsData() {
return api.get<Model.GPSResonse>(API_GET_GPS);
return api.get<Model.GPSResponse>(API_GET_GPS);
}
export async function queryAlarm() {

View File

@@ -1,6 +1,18 @@
import { api } from "@/config";
import { API_GET_TRIP } from "@/constants";
import {
API_GET_TRIP,
API_HAUL_HANDLE,
API_UPDATE_TRIP_STATUS,
} from "@/constants";
export async function queryTrip() {
return api.get<Model.Trip>(API_GET_TRIP);
}
export async function queryUpdateTripState(body: Model.TripUpdateStateRequest) {
return api.put(API_UPDATE_TRIP_STATUS, body);
}
export async function queryStartNewHaul(body: Model.NewFishingLogRequest) {
return api.put(API_HAUL_HANDLE, body);
}

View File

@@ -7,7 +7,7 @@ declare namespace Model {
token?: string;
}
interface GPSResonse {
interface GPSResponse {
lat: number;
lon: number;
s: number;
@@ -174,4 +174,16 @@ declare namespace Model {
fish_condition?: string;
gear_usage?: string;
}
interface NewFishingLogRequest {
trip_id: string;
start_at: Date; // ISO datetime
start_lat: number;
start_lon: number;
weather_description: string;
}
interface TripUpdateStateRequest {
status: number;
note?: string;
}
}