feat(08-05-interaction-pattern-unification): 统一前端交互与反馈模式
这个提交包含在:
@@ -1,9 +1,9 @@
|
||||
import { resolveErrorMessage as resolveUserErrorMessage } from "../lib/resolveErrorMessage";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||
import { toast } from "sonner";
|
||||
import { fetchAssets, type AssetItem } from "../api/assets";
|
||||
import { mapApiErrorMessage } from "../api/errorMessages";
|
||||
import {
|
||||
fetchInventoryChecks,
|
||||
recordInventoryItems,
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
type InventoryCheck,
|
||||
type InventoryCheckResult,
|
||||
} from "../api/inventoryChecks";
|
||||
import { isApiError } from "../api/types";
|
||||
import { useAuth } from "../auth/AuthContext";
|
||||
import { hasPermission } from "../auth/permissions";
|
||||
import { ActionConfirmDialog } from "../components/common/ActionConfirmDialog";
|
||||
@@ -29,13 +28,7 @@ import {
|
||||
} from "../mobile/inventoryScanQueue";
|
||||
|
||||
function resolveErrorMessage(error: unknown) {
|
||||
if (isApiError(error)) {
|
||||
return `${error.code}: ${mapApiErrorMessage(error.code, error.details, error.message)}`;
|
||||
}
|
||||
if (error instanceof Error) {
|
||||
return error.message;
|
||||
}
|
||||
return "请求失败,请稍后重试。";
|
||||
return resolveUserErrorMessage(error, "请求失败,请稍后重试。");
|
||||
}
|
||||
|
||||
function statusLabel(status: string) {
|
||||
|
||||
在新工单中引用
屏蔽一个用户