mirror of
https://github.com/xtr-dev/payload-feature-flags.git
synced 2025-12-12 11:53:25 +00:00
Remove custom API endpoints in favor of Payload's native REST API
- Removed custom endpoint handler and endpoints directory - Removed enableApi configuration option from plugin - Updated client hooks to use Payload's native collection API - Updated documentation to reflect API changes - Updated view component to handle Payload API response format The plugin now uses Payload CMS's built-in REST API for the feature-flags collection, which provides standard query syntax, pagination, and automatic access control enforcement. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -53,17 +53,13 @@ const FeatureFlagsViewComponent = () => {
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
if (response.status === 404) {
|
||||
setError('Feature flags API not enabled. Set enableApi: true in plugin config.')
|
||||
return
|
||||
}
|
||||
throw new Error(`Failed to fetch feature flags: ${response.statusText}`)
|
||||
}
|
||||
|
||||
|
||||
const result = await response.json()
|
||||
|
||||
// Convert the result object to an array if it's not already
|
||||
const flagsArray = Array.isArray(result) ? result : Object.values(result || {})
|
||||
|
||||
// Extract docs array from Payload API response
|
||||
const flagsArray = result.docs || []
|
||||
|
||||
// Only update state if the component is still mounted (signal not aborted)
|
||||
if (!signal?.aborted) {
|
||||
|
||||
Reference in New Issue
Block a user