fix(admin-ui): Create fulfillment (#3607)

* fix for create-fulfillment

* remove ff check

* add changeset

* Disable Create fulfillment button if no quantities fulfilled

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Rares Capilnar <rares.capilnar@gmail.com>
This commit is contained in:
Philip Korsholm
2023-03-28 19:04:35 +02:00
committed by GitHub
co-authored by Oliver Windall Juhl Rares Capilnar
parent bca1f80dd5
commit d1a6aa5a90
9 changed files with 52 additions and 11 deletions
@@ -1,7 +1,22 @@
import { useAdminStockLocations } from "medusa-react"
import { useEffect } from "react"
import { useFeatureFlag } from "../providers/feature-flag-provider"
const useStockLocations = () => {
const { stock_locations } = useAdminStockLocations()
const { isFeatureEnabled } = useFeatureFlag()
const isStockLocationsEnabled = isFeatureEnabled("stockLocationService")
const { stock_locations, refetch } = useAdminStockLocations(
{},
{
enabled: isStockLocationsEnabled,
}
)
useEffect(() => {
if (isStockLocationsEnabled) {
void refetch()
}
}, [isStockLocationsEnabled, refetch])
const getLocationNameById = (locationId: string | null) =>
stock_locations?.find((stock_location) => stock_location.id === locationId)