fix authorize
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
}
|
||||
catch { /* 忽略网络错误,仍继续清理客户端状态 */ }
|
||||
|
||||
if (AuthStateProvider is Atomx.Admin.Client.Utils.PersistentAuthenticationStateProvider provider)
|
||||
if (AuthStateProvider is PersistentAuthenticationStateProvider provider)
|
||||
{
|
||||
await provider.MarkUserAsLoggedOut();
|
||||
}
|
||||
@@ -41,6 +41,14 @@
|
||||
var success = jsResult.ValueKind == JsonValueKind.Object && jsResult.TryGetProperty("success", out var sp) && sp.GetBoolean();
|
||||
Logger.LogInformation("Server logout result: {Success}", success);
|
||||
|
||||
try
|
||||
{
|
||||
// 清理 localStorage(如果有的话)
|
||||
await localStorage.RemoveItemAsync(StorageKeys.AccessToken);
|
||||
await localStorage.RemoveItemAsync(StorageKeys.RefreshToken);
|
||||
}
|
||||
catch { }
|
||||
|
||||
// 尽管我们可能已经处理了服务器态,强制重新加载确保 Circuit 更新
|
||||
Navigation.NavigateTo("/account/login", forceLoad: true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user