We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5934915 commit 62cc059Copy full SHA for 62cc059
modules/posthog/runtime/composables/usePostHogFeatureFlag.ts
@@ -2,6 +2,7 @@ import { useState } from '#app';
2
import type { JsonType } from 'posthog-js';
3
4
export default () => {
5
+ const { $posthog } = useNuxtApp();
6
const posthogFeatureFlags = useState<Record<string, boolean | string> | undefined>('ph-feature-flags');
7
const posthogFeatureFlagPayloads = useState<Record<string, JsonType> | undefined>('ph-feature-flag-payloads');
8
@@ -10,6 +11,10 @@ export default () => {
10
11
};
12
13
const getFeatureFlag = (feature: string) => {
14
+ if ($posthog) {
15
+ $posthog.getFeatureFlag(feature);
16
+ }
17
+
18
return {
19
value: posthogFeatureFlags.value?.[feature] ?? false,
20
payload: posthogFeatureFlagPayloads.value?.[feature],
0 commit comments