feat(admin-ui): Manage inventory toggle (#4041)
This commit is contained in:
1 parent
1ea57c3a69
commit
353fc94e4f
2 files changed
+10
-2
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/admin-ui": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(admin-ui): toggle manage inventory
|
||||||
+5
-2
@@ -14,13 +14,13 @@ import {
|
|||||||
import Button from "../../fundamentals/button"
|
import Button from "../../fundamentals/button"
|
||||||
import { InventoryLevelDTO } from "@medusajs/types"
|
import { InventoryLevelDTO } from "@medusajs/types"
|
||||||
import Modal from "../../molecules/modal"
|
import Modal from "../../molecules/modal"
|
||||||
|
import { Option } from "../../../types/shared"
|
||||||
|
import { countries } from "../../../utils/countries"
|
||||||
import { queryClient } from "../../../constants/query-client"
|
import { queryClient } from "../../../constants/query-client"
|
||||||
import { removeNullish } from "../../../utils/remove-nullish"
|
import { removeNullish } from "../../../utils/remove-nullish"
|
||||||
import { useContext } from "react"
|
import { useContext } from "react"
|
||||||
import useEditProductActions from "../../../hooks/use-edit-product-actions"
|
import useEditProductActions from "../../../hooks/use-edit-product-actions"
|
||||||
import { useForm } from "react-hook-form"
|
import { useForm } from "react-hook-form"
|
||||||
import { countries } from "../../../utils/countries"
|
|
||||||
import { Option } from "../../../types/shared"
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
@@ -120,6 +120,9 @@ const EditVariantInventoryModal = ({ onClose, product, variant }: Props) => {
|
|||||||
await client.admin.inventoryItems.update(itemId!, upsertPayload)
|
await client.admin.inventoryItems.update(itemId!, upsertPayload)
|
||||||
}
|
}
|
||||||
} else if (manageInventory) {
|
} else if (manageInventory) {
|
||||||
|
await client.admin.products.updateVariant(product.id, variant.id, {
|
||||||
|
manage_inventory: true,
|
||||||
|
})
|
||||||
// does not have an inventory item but wants to manage inventory
|
// does not have an inventory item but wants to manage inventory
|
||||||
const { inventory_item } = await client.admin.inventoryItems.create({
|
const { inventory_item } = await client.admin.inventoryItems.create({
|
||||||
variant_id: variant.id,
|
variant_id: variant.id,
|
||||||
|
|||||||
Reference in new issue
Block a user