fix(mutations): use extractErrorMessage for complete error display

Provider add/update/delete mutations were using error.message directly,
which doesn't extract Tauri invoke errors properly. Now using the same
extractErrorMessage pattern as the rest of the codebase.
This commit is contained in:
Jason
2026-01-31 20:15:39 +08:00
parent b5b45c2703
commit faa82a5b86

View File

@@ -61,10 +61,11 @@ export const useAddProviderMutation = (appId: AppId) => {
);
},
onError: (error: Error) => {
const detail = extractErrorMessage(error) || t("common.unknown");
toast.error(
t("notifications.addFailed", {
defaultValue: "添加供应商失败: {{error}}",
error: error.message,
error: detail,
}),
);
},
@@ -92,10 +93,11 @@ export const useUpdateProviderMutation = (appId: AppId) => {
);
},
onError: (error: Error) => {
const detail = extractErrorMessage(error) || t("common.unknown");
toast.error(
t("notifications.updateFailed", {
defaultValue: "更新供应商失败: {{error}}",
error: error.message,
error: detail,
}),
);
},
@@ -133,10 +135,11 @@ export const useDeleteProviderMutation = (appId: AppId) => {
);
},
onError: (error: Error) => {
const detail = extractErrorMessage(error) || t("common.unknown");
toast.error(
t("notifications.deleteFailed", {
defaultValue: "删除供应商失败: {{error}}",
error: error.message,
error: detail,
}),
);
},