diff --git a/frontend/app/(dashboard)/admin/page.tsx b/frontend/app/(dashboard)/admin/page.tsx index 191b51d1..1584fd83 100644 --- a/frontend/app/(dashboard)/admin/page.tsx +++ b/frontend/app/(dashboard)/admin/page.tsx @@ -2,17 +2,16 @@ import { useEffect, useState } from "react"; import { useRouter } from "next/navigation"; -import { adminApi } from "@/lib/api/admin.api"; +import { adminApi, type AdminStatsResponse } from "@/lib/api/admin.api"; import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; -import { Skeleton } from "@/components/ui/skeleton"; import { cn } from "@/lib/utils"; -import { useUser } from "@/lib/hooks/useUser"; // assumes you have a user hook +import { useAuthStore } from "@/stores/auth.store"; export default function AdminStatsPage() { const router = useRouter(); - const { user, loading: userLoading } = useUser(); - const [stats, setStats] = useState(null); + const { user, isLoading: userLoading } = useAuthStore(); + const [stats, setStats] = useState(null); const [loading, setLoading] = useState(true); // Redirect non-admins @@ -22,8 +21,16 @@ export default function AdminStatsPage() { } }, [user, userLoading, router]); - // Fetch stats useEffect(() => { + if (userLoading) { + return; + } + + if (user?.role !== "admin") { + setLoading(false); + return; + } + async function fetchStats() { try { const data = await adminApi.getStats(); @@ -34,59 +41,60 @@ export default function AdminStatsPage() { setLoading(false); } } + fetchStats(); - }, []); + }, [user, userLoading]); - if (loading) { + if (userLoading || loading) { return (
{Array.from({ length: 10 }).map((_, i) => ( - +
))}
); } + if (!user || user.role !== "admin" || !stats) { + return null; + } + return (

Admin Overview

- {/* User stats */}
- - - + + +
- {/* Shipment stats */}
- - - + + + 0} + value={stats.shipments.disputesPending} + destructive={stats.shipments.disputesPending > 0} /> - +
- {/* Revenue */}
- {/* Quick navigation */}
@@ -101,7 +109,7 @@ function StatCard({ destructive = false, }: { title: string; - value: any; + value: string | number; destructive?: boolean; }) { return ( diff --git a/frontend/app/(dashboard)/marketplace/page.tsx b/frontend/app/(dashboard)/marketplace/page.tsx index 8e0a35fd..425d9b0f 100644 --- a/frontend/app/(dashboard)/marketplace/page.tsx +++ b/frontend/app/(dashboard)/marketplace/page.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useEffect, useState } from 'react'; +import { useCallback, useEffect, useState } from 'react'; import { shipmentApi } from '../../../lib/api/shipment.api'; import { PaginatedShipments } from '../../../types/shipment.types'; import { ShipmentCard } from '../../../components/shipment/shipment-card'; @@ -15,7 +15,7 @@ export default function MarketplacePage() { const [destination, setDestination] = useState(''); const [page, setPage] = useState(1); - const fetchMarketplace = async (pg = 1) => { + const fetchMarketplace = useCallback(async (pg = 1) => { setLoading(true); try { const data = await shipmentApi.marketplace({ @@ -31,11 +31,11 @@ export default function MarketplacePage() { } finally { setLoading(false); } - }; + }, [destination, origin]); useEffect(() => { fetchMarketplace(1); - }, []); + }, [fetchMarketplace]); const handleSearch = (e: React.FormEvent) => { e.preventDefault(); diff --git a/frontend/app/(dashboard)/settings/page.tsx b/frontend/app/(dashboard)/settings/page.tsx index 69dd690f..6939996e 100644 --- a/frontend/app/(dashboard)/settings/page.tsx +++ b/frontend/app/(dashboard)/settings/page.tsx @@ -4,8 +4,8 @@ import { useForm } from "react-hook-form"; import { z } from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; import { toast } from "sonner"; -import { authApi } from "@/lib/api/auth.api"; -import { logout } from "@/stores/auth.store"; +import { changePassword } from "@/lib/api/auth.api"; +import { useAuthStore } from "@/stores/auth.store"; import { Card, CardHeader, @@ -29,7 +29,17 @@ const schema = z type FormValues = z.infer; +function getErrorMessage(error: unknown): string { + if (error instanceof Error && error.message) { + return error.message; + } + + return "Failed to change password"; +} + export default function SettingsPage() { + const logout = useAuthStore((state) => state.logout); + const { register, handleSubmit, @@ -41,19 +51,16 @@ export default function SettingsPage() { const onSubmit = async (values: FormValues) => { try { - await authApi.changePassword({ - currentPassword: values.currentPassword, - newPassword: values.newPassword, - }); + await changePassword(values.currentPassword, values.newPassword); toast.success("Password changed successfully. You will be signed out."); reset(); setTimeout(() => { - logout(); + void logout(); }, 1500); - } catch (err: any) { - toast.error(err.message || "Failed to change password"); + } catch (error) { + toast.error(getErrorMessage(error)); } }; diff --git a/frontend/app/(dashboard)/shipments/[id]/page.tsx b/frontend/app/(dashboard)/shipments/[id]/page.tsx index 90f97631..c086afb5 100644 --- a/frontend/app/(dashboard)/shipments/[id]/page.tsx +++ b/frontend/app/(dashboard)/shipments/[id]/page.tsx @@ -1,80 +1,6 @@ 'use client'; -<<<<<<< HEAD -import React, { useEffect, useState } from 'react'; -import { useParams } from 'next/navigation'; -import { shipmentApi } from '@/services/shipmentApi'; -import ShipmentTimeline from '@/components/ShipmentTimeline'; -import { toast } from 'react-hot-toast'; - -type UserRole = 'shipper' | 'carrier' | 'admin'; -type ShipmentStatus = - | 'PENDING' - | 'ACCEPTED' - | 'IN_TRANSIT' - | 'DELIVERED' - | 'DISPUTED' - | 'COMPLETED' - | 'CANCELLED'; - -interface Shipment { - id: string; - description: string; - weight: number; - volume: number; - price: number; - origin: string; - destination: string; - shipperName: string; - carrierName?: string; - status: ShipmentStatus; -} - -interface HistoryEvent { - id: string; - status: ShipmentStatus; - timestamp: string; -} - -export default function ShipmentDetailPage() { - const params = useParams(); - const id = params?.id as string; - - const [shipment, setShipment] = useState(null); - const [history, setHistory] = useState([]); - const [loading, setLoading] = useState(true); - const [actionLoading, setActionLoading] = useState(false); - - const fetchData = async () => { - try { - setLoading(true); - const [shipmentRes, historyRes] = await Promise.all([ - shipmentApi.getById(id), - shipmentApi.getHistory(id), - ]); - setShipment(shipmentRes); - setHistory(historyRes); - } catch (err) { - toast.error('Failed to load shipment'); - } finally { - setLoading(false); - } - }; - - useEffect(() => { - if (id) fetchData(); - }, [id]); - - const handleAction = async (action: string) => { - try { - setActionLoading(true); - await shipmentApi.performAction(id, action); - toast.success(`Action "${action}" successful`); - await fetchData(); - } catch (err) { - toast.error(`Failed to perform action: ${action}`); -======= -import { useEffect, useState } from 'react'; +import { useCallback, useEffect, useState } from 'react'; import { useParams, useRouter } from 'next/navigation'; import { toast } from 'sonner'; import { Shipment, ShipmentStatus, ShipmentStatusHistory } from '../../../../types/shipment.types'; @@ -95,21 +21,21 @@ export default function ShipmentDetailPage() { const [loading, setLoading] = useState(true); const [actionLoading, setActionLoading] = useState(false); - const reload = async () => { + const reload = useCallback(async () => { const [s, h] = await Promise.all([ shipmentApi.getById(id), shipmentApi.getHistory(id), ]); setShipment(s); setHistory(h); - }; + }, [id]); useEffect(() => { setLoading(true); reload() .catch(() => toast.error('Failed to load shipment')) .finally(() => setLoading(false)); - }, [id]); + }, [reload]); const act = async (fn: () => Promise, successMsg: string) => { setActionLoading(true); @@ -119,86 +45,11 @@ export default function ShipmentDetailPage() { await reload(); } catch { toast.error('Action failed. Please try again.'); ->>>>>>> main } finally { setActionLoading(false); } }; -<<<<<<< HEAD - const renderActions = () => { - const role: UserRole = 'carrier'; // TODO: derive from auth context - const { status, carrierName } = shipment!; - - const buttons: JSX.Element[] = []; - - if (status === 'PENDING' && role !== 'shipper') { - buttons.push(); - } - if (status === 'ACCEPTED' && role === 'carrier' && carrierName) { - buttons.push(); - } - if (status === 'IN_TRANSIT' && role === 'carrier' && carrierName) { - buttons.push(); - } - if (status === 'DELIVERED' && role === 'shipper') { - buttons.push(); - } - if (['PENDING', 'ACCEPTED'].includes(status) && ['shipper', 'carrier', 'admin'].includes(role)) { - buttons.push(); - } - if (['IN_TRANSIT', 'DELIVERED'].includes(status) && ['shipper', 'carrier'].includes(role)) { - buttons.push(); - } - if (status === 'DISPUTED' && role === 'admin') { - buttons.push( -
- - -
- ); - } - if (['COMPLETED', 'CANCELLED'].includes(status)) { - buttons.push(

No further actions

); - } - - return
{buttons}
; - }; - - // ...rest of your JSX - - return ( -
- {/* Left: Details + Actions */} -
-
-

Cargo

-
    -
  • Description: {shipment.description}
  • -
  • Weight: {shipment.weight} kg
  • -
  • Volume: {shipment.volume} m³
  • -
  • Price: ${shipment.price}
  • -
-
- -
-

Parties

-
    -
  • Shipper: {shipment.shipperName}
  • -
  • Carrier: {shipment.carrierName || '—'}
  • -
-
- -
-

Actions

- {renderActions()} -
-
- - {/* Right: Timeline */} -
- -======= if (loading) { return (
@@ -448,7 +299,6 @@ export default function ShipmentDetailPage() {
->>>>>>> main
); diff --git a/frontend/app/error.tsx b/frontend/app/error.tsx new file mode 100644 index 00000000..bbd87f1e --- /dev/null +++ b/frontend/app/error.tsx @@ -0,0 +1,76 @@ +"use client"; + +import { useEffect } from "react"; +import { AlertTriangle, RefreshCcw } from "lucide-react"; +import { buttonVariants } from "../components/ui/button"; +import { cn } from "../lib/utils"; + +type ErrorPageProps = { + error: Error & { digest?: string }; + reset: () => void; +}; + +export default function GlobalError({ error, reset }: ErrorPageProps) { + useEffect(() => { + console.error(error); + }, [error]); + + return ( + + +
+
+
+ +
+
+
+ +
+

+ Application error +

+

+ Something went wrong +

+

+ FreightFlow hit an unexpected problem while rendering this page. You can retry the + request or leave this screen and continue from your dashboard. +

+
+ + {error.digest ? ( +
+

+ Support reference +

+ {error.digest} +
+ ) : null} + +
+ + + Go to Dashboard + +
+
+
+ + + ); +} \ No newline at end of file diff --git a/frontend/app/not-found.tsx b/frontend/app/not-found.tsx new file mode 100644 index 00000000..28fad60a --- /dev/null +++ b/frontend/app/not-found.tsx @@ -0,0 +1,47 @@ +import Link from "next/link"; +import { buttonVariants } from "../components/ui/button"; +import { cn } from "../lib/utils"; + +export default function NotFound() { + return ( +
+
+
+ +
+
+ FF +
+ +

+ 404 +

+

+ Page not found +

+

+ The route you requested does not exist or may have moved. Jump back into FreightFlow + from the dashboard or head straight to your shipment workspace. +

+ +
+ + Go to Dashboard + + + View Shipments + +
+
+
+ ); +} \ No newline at end of file diff --git a/frontend/hooks/useShipmentSocket.ts b/frontend/hooks/useShipmentSocket.ts index 8e3b2b5f..e3746da2 100644 --- a/frontend/hooks/useShipmentSocket.ts +++ b/frontend/hooks/useShipmentSocket.ts @@ -3,6 +3,7 @@ import { useEffect, useRef } from 'react'; import { useAuthStore } from '../stores/auth.store'; import { useNotificationStore, type ShipmentNotification } from '../stores/notification.store'; +import { getAccessToken } from '../lib/api/client'; import { connectSocket, disconnectSocket } from '../lib/socket'; import { toast } from 'sonner'; import { ShipmentStatus } from '../types/shipment.types'; @@ -46,10 +47,12 @@ export function useShipmentSocket() { const isConnectedRef = useRef(false); useEffect(() => { + const accessToken = getAccessToken(); + // When user is set, connect the socket - if (user && user.accessToken) { + if (user && accessToken) { if (!isConnectedRef.current) { - const socket = connectSocket(user.accessToken); + const socket = connectSocket(accessToken); socketRef.current = socket; isConnectedRef.current = true; diff --git a/frontend/lib/api/admin.api.ts b/frontend/lib/api/admin.api.ts index 6a07629f..6130d577 100644 --- a/frontend/lib/api/admin.api.ts +++ b/frontend/lib/api/admin.api.ts @@ -10,7 +10,33 @@ export interface ListUsersResponse { totalPages: number; } +export interface AdminStatsResponse { + users: { + total: number; + byRole: { + admin: number; + shipper: number; + carrier: number; + }; + active: number; + inactive: number; + }; + shipments: { + total: number; + byStatus: Record; + disputesPending: number; + }; + revenue: { + totalCompleted: number; + currency: string; + }; +} + export const adminApi = { + getStats: async (): Promise => { + return apiClient('/admin/stats'); + }, + listUsers: async (page = 1, role?: string, status?: string): Promise => { const query = new URLSearchParams(); query.append('page', page.toString()); diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 5006a253..072e0001 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -120,7 +120,6 @@ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", @@ -703,7 +702,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" }, @@ -727,7 +725,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" } @@ -3663,7 +3660,8 @@ "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@types/babel__core": { "version": "7.20.5", @@ -3895,7 +3893,6 @@ "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", "devOptional": true, "license": "MIT", - "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -3906,7 +3903,6 @@ "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", "devOptional": true, "license": "MIT", - "peer": true, "peerDependencies": { "@types/react": "^19.2.0" } @@ -3987,7 +3983,6 @@ "integrity": "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", @@ -4507,7 +4502,6 @@ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -5013,7 +5007,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -5730,7 +5723,8 @@ "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/dom-helpers": { "version": "5.2.1", @@ -6077,7 +6071,6 @@ "integrity": "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -6251,7 +6244,6 @@ "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@rtsao/scc": "^1.1.0", "array-includes": "^3.1.9", @@ -8912,7 +8904,6 @@ "integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "cssstyle": "^4.2.1", "data-urls": "^5.0.0", @@ -9405,6 +9396,7 @@ "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", "dev": true, "license": "MIT", + "peer": true, "bin": { "lz-string": "bin/bin.js" } @@ -9723,6 +9715,17 @@ } } }, + "node_modules/next-intl/node_modules/@swc/helpers": { + "version": "0.5.20", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.20.tgz", + "integrity": "sha512-2egEBHUMasdypIzrprsu8g+OEVd7Vp2MM3a2eVlM/cyFYto0nGz5BX5BTgh/ShZZI9ed+ozEq+Ngt+rgmUs8tw==", + "license": "Apache-2.0", + "optional": true, + "peer": true, + "dependencies": { + "tslib": "^2.8.0" + } + }, "node_modules/next/node_modules/postcss": { "version": "8.4.31", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", @@ -10328,6 +10331,7 @@ "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", @@ -10343,6 +10347,7 @@ "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=10" }, @@ -10420,7 +10425,6 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -10430,7 +10434,6 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz", "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", "license": "MIT", - "peer": true, "dependencies": { "scheduler": "^0.26.0" }, @@ -10443,7 +10446,6 @@ "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.71.2.tgz", "integrity": "sha512-1CHvcDYzuRUNOflt4MOq3ZM46AronNJtQ1S7tnX6YN4y72qhgiUItpacZUAQ0TyWYci3yz1X+rXaSxiuEm86PA==", "license": "MIT", - "peer": true, "engines": { "node": ">=18.0.0" }, @@ -10460,7 +10462,8 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/react-remove-scroll": { "version": "2.7.2", @@ -11673,7 +11676,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -11932,7 +11934,6 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "devOptional": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/frontend/package.json b/frontend/package.json index 0cdf47b6..990a1a24 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,9 +7,9 @@ "build": "next build --turbopack", "start": "next start", "lint": "eslint", - "test": "jest", + "test": "jest --passWithNoTests", "test:watch": "jest --watch", - "test:coverage": "jest --coverage" + "test:coverage": "jest --coverage --passWithNoTests" }, "dependencies": { "@hookform/resolvers": "^5.2.2", diff --git a/frontend/services/shipmentApi.ts b/frontend/services/shipmentApi.ts index b16cd44c..a4391ab9 100644 --- a/frontend/services/shipmentApi.ts +++ b/frontend/services/shipmentApi.ts @@ -1,26 +1,12 @@ -import axios from 'axios'; - - -interface MarketplaceResponse { - data: Shipment[]; - totalPages: number; - totalCount: number; -} - -interface Shipment { - id: string; - origin: string; - destination: string; - weight?: number; - price?: number; - pickupDate?: string; -} +import { shipmentApi as shipmentApiClient } from '../lib/api/shipment.api'; +import type { PaginatedShipments } from '../types/shipment.types'; export const shipmentApi = { - async marketplace(params?: { origin?: string; destination?: string; page?: number }): Promise { - const response = await axios.get('/api/shipments/marketplace', { - params, - }); - return response.data; + async marketplace(params?: { + origin?: string; + destination?: string; + page?: number; + }): Promise { + return shipmentApiClient.marketplace(params); }, };