From 6c84a04fb5fee6330d836e12766678702e927213 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 3 Apr 2024 20:08:09 +0800 Subject: [PATCH] refactor: add default handler for delete telemetry action --- src/client/components/telemetry/TelemetryList.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client/components/telemetry/TelemetryList.tsx b/src/client/components/telemetry/TelemetryList.tsx index 5c3a9ac..3a5a3f6 100644 --- a/src/client/components/telemetry/TelemetryList.tsx +++ b/src/client/components/telemetry/TelemetryList.tsx @@ -11,7 +11,12 @@ import { Typography, } from 'antd'; import React, { useMemo, useState } from 'react'; -import { AppRouterOutput, trpc } from '../../api/trpc'; +import { + AppRouterOutput, + defaultErrorHandler, + defaultSuccessHandler, + trpc, +} from '../../api/trpc'; import { useCurrentWorkspaceId } from '../../store/user'; import { type ColumnsType } from 'antd/es/table/interface'; import { @@ -209,7 +214,10 @@ const TelemetryListTable: React.FC<{ workspaceId, }); const navigate = useNavigate(); - const deleteMutation = trpc.telemetry.delete.useMutation(); + const deleteMutation = trpc.telemetry.delete.useMutation({ + onSuccess: defaultSuccessHandler, + onError: defaultErrorHandler, + }); const columns = useMemo((): ColumnsType => { return [