Blazor Route Parameter as base

Viewed 142

Story: My plan is to use a Route Parameter to define which Tenant is selected on Client Side. I'm using Blazor Server Model.

Problem: Now I'm define "/{TenantId}/X" in every Page.

Class:

public class Dashboard : ComponentBase
{

    [Parameter] public string TenantId { get; set; }

}

Page:

 @page "/{TenantId}/dashboard"
 @inherits DashboardBase

 <p>You have selected tenant: @TenantId</p>

Goal: My goal is to prevent to define it in every page and have it in a global way. So I can only type like that example code below:

Page:

 @page "/dashboard"

But I'm afraid it is impossible and BaseUrl can't really have a Route Parameter I guess. I have many creative ideas but I feel now I'm stuck cause my bad experience in Blazor.

Another question is that if I can use any middleware on client side or modify the the Router somehow?

0 Answers
Related