In this episode, we do a deep dive into properly handling feature toggling for account-related features in our app. You’ll see how we need to update both the backend and the frontend so features like password updates, two-factor authentication, and profile info management behave correctly when enabled or disabled.
We start by disabling the password update feature and notice that, while the backend blocks requests, the frontend still shows the form—oops! We then add checks in our components so those forms and navigation items only show up if the corresponding features are enabled. The same goes for two-factor authentication: when it’s off, its UI elements disappear.
Then we tackle the bigger picture: if all security features are disabled, the entire Security menu and routes should vanish, too. We hook into a helper in Fortify to only show the security menu (and route!) if at least one feature is enabled. We also make sure the user navigation and mobile nav update to reflect these changes, so there are no broken links or buttons leading nowhere.
Next up, we realize the update-profile-info feature hasn’t been updated yet, so we repeat the process for it, adding toggles and updating navigations. Along the way, we squash a quick bug with the profile photo upload by making the file field nullable, ensuring you can update your info even if you don’t choose a new image.
Every step of the way, we test disabling and re-enabling these features to make sure the UI lines up with backend capabilities, and the app no longer has sneaky dead-ends or errors when a feature is toggled off. By the end, we’ve set up a much more robust and seamless experience for toggling account features—just how it should be!