From f995810d1966632f72d683f1207aea76f6a8678c Mon Sep 17 00:00:00 2001 From: Lilian Date: Thu, 20 Mar 2025 20:02:59 +0100 Subject: [PATCH] [frontend/components] Add button to clear local storage on error UI --- Iceshrimp.Frontend/Components/ErrorUi.razor | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Iceshrimp.Frontend/Components/ErrorUi.razor b/Iceshrimp.Frontend/Components/ErrorUi.razor index 7138f9b7..d771c1c6 100644 --- a/Iceshrimp.Frontend/Components/ErrorUi.razor +++ b/Iceshrimp.Frontend/Components/ErrorUi.razor @@ -1,4 +1,5 @@ @using System.Text +@using Blazored.LocalStorage @using Iceshrimp.Assets.PhosphorIcons @using Iceshrimp.Frontend.Core.InMemoryLogger @using Iceshrimp.Frontend.Core.Services @@ -9,6 +10,8 @@ @inject VersionService Version; @inject InMemoryLogService LogService; @inject IJSRuntime Js; +@inject ISyncLocalStorageService LocalStorage; +@inject SessionService Session;

@Loc["Unhandled Exception has occured"]

@@ -53,6 +56,7 @@
+ @@ -78,4 +82,11 @@ var logBytes = LogService.GetLogs().SelectMany(p => Encoding.UTF8.GetBytes(p)).ToArray(); _module.InvokeVoid("DownloadFile", "log.txt", "text/plain", logBytes); } + + private void ClearStorage() + { + Session.EndSession(); + LocalStorage.Clear(); + Navigation.NavigateTo("/", true); + } } \ No newline at end of file