mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-27 21:23:20 +08:00
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:
@@ -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,
|
||||
}),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user