fix(dashboard, fulfilment): fulfilment providers enabled check (#9415)

**What**
- hide disabled fulfilment providers on the admin
- check if the fulfilment provider has an identifier when loading providers

---

FIXES CC-549
This commit is contained in:
Frane Polić
2024-10-02 16:48:40 +02:00
committed by GitHub
parent b39ba45b81
commit ab7e71a055
7 changed files with 23 additions and 7 deletions

View File

@@ -20,6 +20,7 @@ function LocationsFulfillmentProvidersSection({
const { fulfillment_providers } = useFulfillmentProviders({
stock_location_id: location.id,
fields: "id",
is_enabled: true,
})
return (

View File

@@ -69,7 +69,7 @@ export const LocationEditFulfillmentProvidersForm = ({
const { fulfillment_providers, count, isLoading, isError, error } =
useFulfillmentProviders(
{ ...searchParams },
{ ...searchParams, is_enabled: true },
{ placeholderData: keepPreviousData }
)

View File

@@ -6,12 +6,10 @@ import { LocationEditFulfillmentProvidersForm } from "./components/edit-fulfillm
export const LocationFulfillmentProviders = () => {
const { location_id } = useParams()
const { stock_location, isPending, isError, error } = useStockLocation(
location_id!,
{ fields: "id,*fulfillment_providers" }
)
const { stock_location, isPending, isFetching, isError, error } =
useStockLocation(location_id!, { fields: "id,*fulfillment_providers" })
const ready = !isPending && !!stock_location
const ready = !isPending && !isFetching && !!stock_location
if (isError) {
throw error

View File

@@ -10,7 +10,9 @@ export const RegionCreate = () => {
const storeCurrencies = (store?.supported_currencies ?? []).map(
(c) => currencies[c.currency_code.toUpperCase()]
)
const { payment_providers: paymentProviders = [] } = usePaymentProviders()
const { payment_providers: paymentProviders = [] } = usePaymentProviders({
is_enabled: true,
})
if (isError) {
throw error

View File

@@ -50,6 +50,7 @@ export const RegionEdit = () => {
)
const { payment_providers: paymentProviders = [] } = usePaymentProviders({
limit: 999,
is_enabled: true,
})
if (isRegionError) {