mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-02 18:41:35 +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) => {
|
onError: (error: Error) => {
|
||||||
|
const detail = extractErrorMessage(error) || t("common.unknown");
|
||||||
toast.error(
|
toast.error(
|
||||||
t("notifications.addFailed", {
|
t("notifications.addFailed", {
|
||||||
defaultValue: "添加供应商失败: {{error}}",
|
defaultValue: "添加供应商失败: {{error}}",
|
||||||
error: error.message,
|
error: detail,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -92,10 +93,11 @@ export const useUpdateProviderMutation = (appId: AppId) => {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onError: (error: Error) => {
|
onError: (error: Error) => {
|
||||||
|
const detail = extractErrorMessage(error) || t("common.unknown");
|
||||||
toast.error(
|
toast.error(
|
||||||
t("notifications.updateFailed", {
|
t("notifications.updateFailed", {
|
||||||
defaultValue: "更新供应商失败: {{error}}",
|
defaultValue: "更新供应商失败: {{error}}",
|
||||||
error: error.message,
|
error: detail,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -133,10 +135,11 @@ export const useDeleteProviderMutation = (appId: AppId) => {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onError: (error: Error) => {
|
onError: (error: Error) => {
|
||||||
|
const detail = extractErrorMessage(error) || t("common.unknown");
|
||||||
toast.error(
|
toast.error(
|
||||||
t("notifications.deleteFailed", {
|
t("notifications.deleteFailed", {
|
||||||
defaultValue: "删除供应商失败: {{error}}",
|
defaultValue: "删除供应商失败: {{error}}",
|
||||||
error: error.message,
|
error: detail,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user