Files
front/.kilocode/rules-code/AGENTS.md
2026-07-05 21:21:53 +08:00

22 lines
912 B
Markdown

# Code Mode Rules (Non-Obvious Only)
## Development Constraints
- Code is not deployed yet; do not spend effort preserving backward compatibility with old code.
## API Layer
- Two axios instances exist: [`request.ts`](src/api/request.ts) (custom with workspace header) and [`interceptor.ts`](src/api/interceptor.ts) (global with Bearer token). Choose based on whether you need workspace support.
## Storage
- Always use [`SafeStorage`](src/utils/safeStorage.ts) with `AppStorageKey` enum - never use localStorage directly. Supports TTL via third parameter.
## useRequest Hook
- [`useRequest()`](src/hooks/request.ts) invokes API immediately - does NOT work in async functions. Pass params via `.bind(null, params)` pattern.
## Dynamic Routes
- Routes loaded from server in [`permission.ts`](src/router/guard/permission.ts) using `isMenuLoading`/`isMenuLoaded` flags. Don't modify these flags manually.