|
1
|
import { useParams } from "react-router-dom" |
|
2
|
|
|
3
|
import { RouteFocusModal } from "../../../components/modals" |
|
4
|
import { useStockLocation } from "../../../hooks/api/stock-locations" |
|
5
|
import { LocationEditFulfillmentProvidersForm } from "./components/edit-fulfillment-providers-form" |
|
6
|
|
|
7
|
export const LocationFulfillmentProviders = () => { |
|
8
|
const { location_id } = useParams() |
|
9
|
const { stock_location, isPending, isError, error } = useStockLocation( |
|
10
|
location_id!, |
|
11
|
{ fields: "id,*fulfillment_providers" } |
|
12
|
) |
|
13
|
|
|
14
|
const ready = !isPending && !!stock_location |
|
15
|
|
|
16
|
if (isError) { |
|
17
|
throw error |
|
18
|
} |
|
19
|
|
|
20
|
return ( |
|
21
|
<RouteFocusModal> |
|
22
|
{ready && ( |
|
23
|
<LocationEditFulfillmentProvidersForm location={stock_location} /> |
|
24
|
)} |
|
25
|
</RouteFocusModal> |
|
26
|
) |
|
27
|
} |