I need some help on how to architecture a Blazor application to achieve what I need.
All the pages for this application must have the same starting parameter, say AccountId. So a product page could be like "/product/{AccountId}", customer page could be like "/customer/{AccountId}". This AccountId value is used to retrieve basic account information like name, phone.
The site shares global nav bars, here is what the MainLayout looks like:
<TopNav></TopNav>
<LeftNav></LeftNav>
<main class="app-main">
<div class="wrapper">
<div class="page">
<div class="page-inner">
@Body
</div>
</div>
</div>
What I need is to display the account name in the TopNav layout component. I've tried to create a BasePage class that they all inherit from and tried to fetch the account info in the OnInitializedAsync() of the BasePage and set a protected variable. However, the TopNav component does not receive this value and always see it as null.
Just how should I structure my application so that both the individual page component, and all the layout component receives this same account info object?
Thanks a lot!