fix(freight-portal): add missing /api prefix to bulk truck upload endpoint

BulkTruckUploadModal hand-built its POST URL and omitted the global
/api prefix every other booking call uses, causing a 404. Added
CUSTOMER_TRUCKS_BULK to URL_CONSTANTS.BOOKINGS and switched the modal
to use it.
This commit is contained in:
Hagernesh
2026-08-01 08:42:18 +00:00
parent af1d64d0bd
commit 1998c74b9e
2 changed files with 4 additions and 1 deletions

View File

@@ -130,6 +130,8 @@ export const URL_CONSTANTS = {
CANCEL: (id: string | number) => `/api/bookings/${id}/cancel`, CANCEL: (id: string | number) => `/api/bookings/${id}/cancel`,
CONFIRM: (id: string | number) => `/api/bookings/${id}/confirm`, CONFIRM: (id: string | number) => `/api/bookings/${id}/confirm`,
CUSTOMER_TRUCKS: (id: string) => `/api/bookings/${id}/customer-trucks`, CUSTOMER_TRUCKS: (id: string) => `/api/bookings/${id}/customer-trucks`,
CUSTOMER_TRUCKS_BULK: (id: string) =>
`/api/bookings/${id}/customer-trucks/bulk`,
CUSTOMER_TRUCK: (id: string, assignmentId: string) => CUSTOMER_TRUCK: (id: string, assignmentId: string) =>
`/api/bookings/${id}/customer-trucks/${assignmentId}`, `/api/bookings/${id}/customer-trucks/${assignmentId}`,
}, },

View File

@@ -4,6 +4,7 @@ import { Upload, Download, AlertCircle, CheckCircle, AlertTriangle } from "lucid
import { useMutation } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query";
import { client } from "@/utils/api"; import { client } from "@/utils/api";
import { URL_CONSTANTS } from "@/constants/URLS";
import { generateTruckAssignmentTemplate, parseTruckAssignmentFile } from "@/utils/truck-assignment-template"; import { generateTruckAssignmentTemplate, parseTruckAssignmentFile } from "@/utils/truck-assignment-template";
interface BulkTruckUploadModalProps { interface BulkTruckUploadModalProps {
@@ -32,7 +33,7 @@ export function BulkTruckUploadModal({
const uploadMutation = useMutation({ const uploadMutation = useMutation({
mutationFn: async () => { mutationFn: async () => {
const { data } = await client.post(`/bookings/${bookingId}/customer-trucks/bulk`, { const { data } = await client.post(URL_CONSTANTS.BOOKINGS.CUSTOMER_TRUCKS_BULK(bookingId), {
trucks: parsed, trucks: parsed,
}); });
return data; return data;