diff options
Diffstat (limited to 'app/assets/javascripts/lib/utils/common_utils.js')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 9b0ee40a30a..4a48852159a 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -910,3 +910,18 @@ export const setCookie = (name, value) => Cookies.set(name, value, { expires: 36 export const getCookie = name => Cookies.get(name); export const removeCookie = name => Cookies.remove(name); + +/** + * Returns the status of a feature flag. + * Currently, there is no way to access feature + * flags in Vuex other than directly tapping into + * window.gon. + * + * This should only be used on Vuex. If feature flags + * need to be accessed in Vue components consider + * using the Vue feature flag mixin. + * + * @param {String} flag Feature flag + * @returns {Boolean} on/off + */ +export const isFeatureFlagEnabled = flag => window.gon.features?.[flag]; |