27 lines
1.1 KiB
Plaintext
27 lines
1.1 KiB
Plaintext
@page "/tracks/{Id:long}"
|
|
@using DeepDrftPublic.Client.Services
|
|
@inject IReleaseDataService ReleaseData
|
|
@inject NavigationManager Navigation
|
|
|
|
@* Addressable deep-link fallback for a bare release id (Phase 11 §2, shape iii). Unlike the player
|
|
bar / Archive / AlbumsView call sites, an external /tracks/{id} link carries only the id, so this
|
|
page fetches the release to discover its medium, then forwards through the same ReleaseRoutes
|
|
resolver — one medium→route table, no second source. replace:true keeps the router out of history
|
|
so Back skips this hop. Capture Id before the await per the InteractiveAuto route-param convention. *@
|
|
|
|
@code {
|
|
[Parameter] public long Id { get; set; }
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
var id = Id;
|
|
var result = await ReleaseData.GetById(id);
|
|
|
|
var target = result is { Success: true, Value: { } release }
|
|
? ReleaseRoutes.DetailHref(release)
|
|
: "/cuts"; // Unknown id: fall back to the Cuts gallery rather than 404.
|
|
|
|
Navigation.NavigateTo(target, forceLoad: false, replace: true);
|
|
}
|
|
}
|