feat: add useFeatureFlag hook for feature gating
Selector-based hook reads from authStore.featureFlags. Returns false for unknown keys (fail closed). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
9
frontend/src/hooks/useFeatureFlag.ts
Normal file
9
frontend/src/hooks/useFeatureFlag.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { useAuthStore } from '@/store/authStore'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a feature flag is enabled for the current user.
|
||||||
|
* Returns false for unknown keys (fail closed).
|
||||||
|
*/
|
||||||
|
export function useFeatureFlag(key: string): boolean {
|
||||||
|
return useAuthStore((s) => s.featureFlags[key] ?? false)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user