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:
chihlasm
2026-04-02 15:20:53 +00:00
parent b7e5979d0c
commit cc929c8932

View 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)
}