[Glitch] Add feature flag detection for profile redesign
Port 122b1592ed543838f2047ef82e570ca58a087b32 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
beb23500b1
commit
aa83f94ac1
@ -12,8 +12,21 @@ export function isProduction() {
|
|||||||
else return import.meta.env.PROD;
|
else return import.meta.env.PROD;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Features = 'fasp' | 'http_message_signatures';
|
export type ServerFeatures = 'fasp';
|
||||||
|
|
||||||
export function isFeatureEnabled(feature: Features) {
|
export function isServerFeatureEnabled(feature: ServerFeatures) {
|
||||||
return initialState?.features.includes(feature) ?? false;
|
return initialState?.features.includes(feature) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ClientFeatures = 'profile_redesign';
|
||||||
|
|
||||||
|
export function isClientFeatureEnabled(feature: ClientFeatures) {
|
||||||
|
try {
|
||||||
|
const features =
|
||||||
|
window.localStorage.getItem('experiments')?.split(',') ?? [];
|
||||||
|
return features.includes(feature);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('Could not access localStorage to get client features', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user