improve multi-tenancy navigation

This commit is contained in:
Shaun Walker 2021-06-16 08:30:41 -04:00
parent 65a14da5a9
commit cec24e7446
2 changed files with 14 additions and 5 deletions

View File

@ -51,12 +51,11 @@ else
private void Edit(string name) private void Edit(string name)
{ {
NavigationManager.NavigateTo(_scheme + name + "/admin/site", true); NavigationManager.NavigateTo(_scheme + name + "/admin/site/?redirect");
} }
private void Browse(string name) private void Browse(string name)
{ {
NavigationManager.NavigateTo(_scheme + name, true); NavigationManager.NavigateTo(_scheme + name + "/?redirect", true);
} }
} }

View File

@ -94,6 +94,15 @@
{ {
reload = Reload.Site; reload = Reload.Site;
} }
else
{
// reload the client application if the user navigated to a site with a different alias or there is a forced redirect
if ((!path.StartsWith(SiteState.Alias.Path) && SiteState.Alias.Path != "") || querystring.ContainsKey("redirect"))
{
NavigationManager.NavigateTo(_absoluteUri.Replace("?redirect", ""), true);
return;
}
}
if (PageState != null) if (PageState != null)
{ {
@ -109,7 +118,8 @@
// if running on WebAssembly reload the client application if the server application was restarted // if running on WebAssembly reload the client application if the server application was restarted
if (runtime == Shared.Runtime.WebAssembly && PageState != null && sync.SyncEvents.Exists(item => item.TenantId == -1)) if (runtime == Shared.Runtime.WebAssembly && PageState != null && sync.SyncEvents.Exists(item => item.TenantId == -1))
{ {
NavigationManager.NavigateTo(_absoluteUri + (!_absoluteUri.Contains("?") ? "?" : "&") + "reload", true); NavigationManager.NavigateTo(_absoluteUri, true);
return;
} }
if (sync.SyncEvents.Exists(item => item.EntityName == EntityNames.Site && item.EntityId == SiteState.Alias.SiteId)) if (sync.SyncEvents.Exists(item => item.EntityName == EntityNames.Site && item.EntityId == SiteState.Alias.SiteId))
{ {
@ -169,7 +179,7 @@
path += "/"; path += "/";
} }
if (SiteState.Alias.Path != "") if (SiteState.Alias.Path != "" && path.StartsWith(SiteState.Alias.Path))
{ {
path = path.Substring(SiteState.Alias.Path.Length + 1); path = path.Substring(SiteState.Alias.Path.Length + 1);
} }