What I'm trying to do is similar to the built in authorization. In our app, our users must select a value for "foo" before they load (nearly) any page. If foo is not selected, they should be routed to the page where they select foo.
Currently, in each page in OnInitialized we check if foo is selected in the CascadingAppState and reroute if it is not. That's not very clean and it's easy to forget to add when creating a new page.
Is there a way we can set this up globally? We would need a way to override it as well because there are a few exceptions.
I was trying to implement a solution that used a custom attribute. I was hoping to put a @attribute [RequiresFooSelection(true)] on a page such as App.razor hoping it would apply to all, then if a page doesn't require foo, use @attribute [RequiresFooSelection(false)] on that page to override. I wasn't able to get that working.
It'd be great to implement it just like @attribute [Authorize] is implemented, but I'm not seeing how to do that.
If I'm overthinking it, I'm open to suggestions!