feat: view config feature flag (#13171)
* feat: add view_configurations feature flag - Add feature flag provider and hooks to admin dashboard - Add backend API endpoint for feature flags - Create view_configurations feature flag (disabled by default) - Update order list table to use legacy version when flag is disabled - Can be enabled with MEDUSA_FF_VIEW_CONFIGURATIONS=true env var * fix: naming * fix: feature flags unauthenticated * fix: add test
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
MedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
||||
|
||||
export const AUTHENTICATE = false
|
||||
|
||||
export const GET = async (
|
||||
req: MedusaRequest,
|
||||
res: MedusaResponse<{ feature_flags: Record<string, boolean> }>
|
||||
) => {
|
||||
const featureFlagRouter = req.scope.resolve(
|
||||
ContainerRegistrationKeys.FEATURE_FLAG_ROUTER
|
||||
) as any
|
||||
|
||||
const flags = featureFlagRouter.listFlags()
|
||||
|
||||
// Convert array of flags to a simple key-value object
|
||||
const featureFlags: Record<string, boolean> = {}
|
||||
flags.forEach(flag => {
|
||||
featureFlags[flag.key] = flag.value
|
||||
})
|
||||
|
||||
res.json({ feature_flags: featureFlags })
|
||||
}
|
||||
Reference in New Issue
Block a user