Files
antd-admin/apps/with-lingui/.github/instructions/api.instructions.md
T
zuiidea c5221c71be feat(with-lingui): orders CRUD, shared hooks, auth refresh, and docs
- Add second sample resource (orders): API, schemas, MSW, routes, menu, Lingui, and E2E.

- Introduce useCrudToasts, useUrlSearchState, useTableFitHeight; extend useResourceCRUD with optimistic updates; add Vitest coverage for hooks and createHandler.

- Implement token refresh in http layer, RouteError, and new E2E specs (auth-refresh, rbac, url-state).

- Replace gen-resource codegen with English add-resource.instructions.md; fix Copilot instruction YAML in with-lingui and basic.

- Add with-lingui CI workflow, Cursor thin rules, optimization plan doc, and refresh README/AGENTS.

- Bump packages/create and lockfile where applicable.

Made-with: Cursor
2026-04-27 14:47:55 +08:00

1.3 KiB

applyTo, description
applyTo description
src/api/**/*.ts,src/utils/http.ts,src/mocks/handlers/**/*.ts,src/mocks/createHandler.ts Use when editing API clients, schemas, HTTP behavior, response types, or MSW endpoint handlers. Keywords: api, http, schema, zod, handler, endpoint, auth, users.

API Instructions

Purpose

Maintain strict API contracts and consistent server/client mock behavior.

Do

  • Keep request/response shapes schema-driven and type-safe.
  • Reuse endpoint constants and shared response helpers.
  • Keep handler response envelope consistent (code, data, message).
  • MSW success payloads: use successWithSchema / paginatedWithSchema / successWithNullBody from src/mocks/createHandler.ts so responses match Zod contracts before HttpResponse.json.
  • Ensure mock handlers reflect real API behavior and error semantics.
  • Keep naming stable for endpoint keys and mutation/query keys.

Do Not

  • Do not return ad-hoc response shapes for one-off convenience.
  • Do not bypass schema parsing in new client mutations/queries.
  • Do not mix unrelated domain endpoints in the same module.

Validation

  • Verify TypeScript and schema parsing paths compile cleanly.
  • Run: pnpm exec vp check --no-fmt
  • After changing createHandler or handler envelopes: pnpm run test:unit (includes src/mocks/createHandler.test.ts).