withApiMetadataFetchFn
在 fetchFn 旁声明 url + method,确保权限校验与真实接口一致。
TSXapi
1import { withApiMetadataFetchFn } from "@quan-erp/shared-types";
2
3export const getBranchApi = withApiMetadataFetchFn({
4 api: { method: "GET", url: "/branch" },
5 fetchFn: async () => { /* return payload */ },
6});受保护页面
用 <Protected requiredApis={getBranchApi} ...> 包裹页面,无权限用户看到受限占位而非坏掉的界面。