feat(web): upgrade feature-flag-client to SSE streaming + getValue()
This commit is contained in:
parent
f0a75a9dc2
commit
f95ba73c31
@ -9,7 +9,12 @@ const featureFlagClient = createFeatureFlagClient({
|
||||
baseUrl: PLATFORM_SERVICE_URL,
|
||||
productId: PRODUCT_ID,
|
||||
platform: "web",
|
||||
useStreaming: true,
|
||||
pollIntervalMs: 5 * 60 * 1000,
|
||||
getAccessToken: () =>
|
||||
typeof window !== "undefined"
|
||||
? localStorage.getItem("access_token")
|
||||
: null,
|
||||
});
|
||||
|
||||
export async function initFeatureFlags(userId?: string) {
|
||||
@ -25,4 +30,11 @@ export function isFeatureEnabled(key: string): boolean {
|
||||
return featureFlagClient.isEnabled(key);
|
||||
}
|
||||
|
||||
export function getFeatureValue<T = boolean | string | number | Record<string, unknown>>(
|
||||
key: string,
|
||||
defaultValue: T,
|
||||
): T {
|
||||
return featureFlagClient.getValue(key, defaultValue);
|
||||
}
|
||||
|
||||
export { featureFlagClient };
|
||||
|
||||
Loading…
Reference in New Issue
Block a user