mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 14:16:12 +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
@@ -15,6 +15,7 @@
|
||||
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { toastWrittenOutcome } from "@/components/outcome/outcome-toast";
|
||||
import {
|
||||
Activity,
|
||||
ArrowRight,
|
||||
@@ -34,6 +35,7 @@ import {
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { apiPost } from "@/lib/api/api-fetch";
|
||||
import { showErrorToast } from "@/lib/errors/error-toast";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import type { IntegrationCallbackUrls } from "@/lib/integrations/callback-urls";
|
||||
import { loadDocument } from "@/lib/navigation/load-document";
|
||||
@@ -298,7 +300,20 @@ export function OAuthIntegrationCardView({
|
||||
mutationFn: async () => {
|
||||
await apiPost(`/api/${provider}/disconnect`);
|
||||
},
|
||||
onSuccess: invalidateStatus,
|
||||
onSuccess: () => {
|
||||
invalidateStatus();
|
||||
toastWrittenOutcome(
|
||||
"success",
|
||||
t("settings.integrationDisconnected", { provider: providerName }),
|
||||
);
|
||||
},
|
||||
// The confirmation dialog has closed by now; without this a refused
|
||||
// disconnect left the card connected and said nothing.
|
||||
onError: (failure) =>
|
||||
showErrorToast(
|
||||
t("settings.integrationDisconnectFailed", { provider: providerName }),
|
||||
{ cause: failure },
|
||||
),
|
||||
});
|
||||
|
||||
const resume = useMutation({
|
||||
|
||||
Reference in new issue
Block a user