fix(admin-ui): Remove t() on product.status update (#5394)
* fix(admin-ui): Remove t() on product.status update * Create tidy-games-drum.md
This commit is contained in:
7
.changeset/tidy-games-drum.md
Normal file
7
.changeset/tidy-games-drum.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
"@medusajs/admin-ui": patch
|
||||
"@medusajs/admin": patch
|
||||
---
|
||||
|
||||
fix(admin-ui): Remove t() on product.status update
|
||||
@@ -48,10 +48,7 @@ const useProductActions = (product: Product) => {
|
||||
? t("product-table-unpublish", "Unpublish")
|
||||
: t("product-table-publish", "Publish"),
|
||||
onClick: () => {
|
||||
const newStatus =
|
||||
product.status === "published"
|
||||
? t("product-table-draft", "draft")
|
||||
: t("product-table-published", "published")
|
||||
const newStatus = product.status === "published" ? "draft" : "published"
|
||||
updateProduct.mutate(
|
||||
{
|
||||
status: newStatus,
|
||||
|
||||
@@ -132,7 +132,6 @@ const useEditProductActions = (productId: string) => {
|
||||
const newStatus = currentStatus === "published" ? "draft" : "published"
|
||||
updateProduct.mutate(
|
||||
{
|
||||
// @ts-ignore TODO fix update type in API
|
||||
status: newStatus,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
import {
|
||||
CreateProductVariantInput,
|
||||
ProductVariantPricesUpdateReq,
|
||||
UpdateProductVariantInput,
|
||||
} from "../../../../types/product-variant"
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
@@ -16,6 +11,8 @@ import {
|
||||
ValidateIf,
|
||||
ValidateNested,
|
||||
} from "class-validator"
|
||||
import { defaultAdminProductFields, defaultAdminProductRelations } from "."
|
||||
import { ProductStatus, ProductVariant } from "../../../../models"
|
||||
import {
|
||||
PricingService,
|
||||
ProductService,
|
||||
@@ -28,22 +25,25 @@ import {
|
||||
ProductTagReq,
|
||||
ProductTypeReq,
|
||||
} from "../../../../types/product"
|
||||
import { ProductStatus, ProductVariant } from "../../../../models"
|
||||
import {
|
||||
CreateProductVariantInput,
|
||||
ProductVariantPricesUpdateReq,
|
||||
UpdateProductVariantInput,
|
||||
} from "../../../../types/product-variant"
|
||||
import {
|
||||
createVariantsTransaction,
|
||||
revertVariantTransaction,
|
||||
} from "./transaction/create-product-variant"
|
||||
import { defaultAdminProductFields, defaultAdminProductRelations } from "."
|
||||
|
||||
import { DistributedTransaction } from "@medusajs/orchestration"
|
||||
import { EntityManager } from "typeorm"
|
||||
import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators"
|
||||
import { IInventoryService } from "@medusajs/types"
|
||||
import { Logger } from "../../../../types/global"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import { ProductVariantRepository } from "../../../../repositories/product-variant"
|
||||
import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels"
|
||||
import { Type } from "class-transformer"
|
||||
import { EntityManager } from "typeorm"
|
||||
import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels"
|
||||
import { ProductVariantRepository } from "../../../../repositories/product-variant"
|
||||
import { Logger } from "../../../../types/global"
|
||||
import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators"
|
||||
import { validator } from "../../../../utils/validator"
|
||||
|
||||
/**
|
||||
@@ -603,7 +603,7 @@ export class AdminPostProductsProductReq {
|
||||
@IsEnum(ProductStatus)
|
||||
@NotEquals(null)
|
||||
@ValidateIf((object, value) => value !== undefined)
|
||||
status?: ProductStatus
|
||||
status: ProductStatus
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => ProductTypeReq)
|
||||
|
||||
Reference in New Issue
Block a user