stephenkr / nuxt-feature-toggle

The nuxt feature toggle module

Home Page:https://www.npmjs.com/package/nuxt-feature-toggle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose true toggle setting in $featureToggles

RyanMulready opened this issue · comments

Say I wanted to handle the feature toggle inside a vue hook.

nuxt.config.js
toggles: {
  'my-toggle': true,
}



component.vue
mounted() {
  if($this.$featureToggles['my-toggle']) {
    alert('my-toggle is on!');
  }
}

This works well. Except if I want to over ride it by using queryString: true ie: /?my-toggle=false. The way the library is injecting $featureToggles into nuxt here but evaluating the query string in the component means this is not possible.

For now the work around is to check the query string yourself but it would be nice if the module had this functionality built in.

Hi @RyanMulready sorry i'm only replying now.

Yes, good idea. Would you be open to contributing a PR :) If not I can work on adding this functionality.

Also thank you for using the module.

It's on my backlog! (Un)fortunately the work around was pretty easy and my backlog is probably as long as yours. If some free time does pop up I'd be happy to revisit this but can't commit to it for now.

That's grand, thanks @RyanMulready.

I'll leave this issue open if anyone is interested in implementing it, or I may sometime in the future :)

Hi, @RyanMulready I think we can now close this issue. Thank you to @israelroldan for adding support 🎉

New version ready https://www.npmjs.com/package/nuxt-feature-toggle

Thank you again for contributing 🚀