mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 22:26:13 +00:00
fix(settings): report the outcome of quiet settings actions
Adding or removing a passkey or a security key only redrew the list. Disconnecting an integration and revoking a share link ran from a dialog that had already closed, so a refused request left everything as it was without a word. The injection-site exclusions, the local OCR switch and the preventive-care reminder switches saved, or did not, in silence. Each now reports through the outcome toast and, where the card has no inline error line, the shared error toast with its error id.
This commit is contained in:
1 parent
b6e3b47bec
commit
2bb3783b14
16 files changed
+302
-30
No files matched your search
@@ -14,6 +14,7 @@
|
||||
* View / sort / order persist client-side via `useModuleListPrefs("labs")`.
|
||||
*/
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { toastWrittenOutcome } from "@/components/outcome/outcome-toast";
|
||||
import {
|
||||
ArrowDownUp,
|
||||
FlaskConical,
|
||||
@@ -29,6 +30,7 @@ import { Label } from "@/components/ui/label";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { apiGet } from "@/lib/api/api-fetch";
|
||||
import { showErrorToast } from "@/lib/errors/error-toast";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import { queryKeys } from "@/lib/query-keys";
|
||||
import { ModuleViewToggle } from "@/components/module-list/module-view-toggle";
|
||||
@@ -139,7 +141,16 @@ export function LabsSettings() {
|
||||
<Switch
|
||||
checked={localOcr.data?.labsLocalOcrEnabled ?? false}
|
||||
disabled={localOcr.isLoading || updateLocalOcr.isPending}
|
||||
onCheckedChange={(checked) => updateLocalOcr.mutate(checked)}
|
||||
onCheckedChange={(checked) =>
|
||||
updateLocalOcr.mutate(checked, {
|
||||
onSuccess: () =>
|
||||
toastWrittenOutcome("success", t("settings.saved")),
|
||||
onError: (failure) =>
|
||||
showErrorToast(t("settings.savingError"), {
|
||||
cause: failure,
|
||||
}),
|
||||
})
|
||||
}
|
||||
aria-label={t("labs.localOcr.heading")}
|
||||
/>
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user